Added checking if the handshake response is a Redirect

This commit is contained in:
sta 2014-12-14 15:34:29 +09:00
parent 3cc62a3590
commit 34be0af5c6

View File

@ -587,7 +587,9 @@ namespace WebSocketSharp
private string checkIfValidHandshakeResponse (HttpResponse response)
{
var headers = response.Headers;
return response.IsUnauthorized
return response.IsRedirect
? "A Redirect response was received."
: response.IsUnauthorized
? "An HTTP authentication is required."
: !response.IsWebSocketResponse
? "Not a WebSocket connection response."
@ -1235,6 +1237,13 @@ namespace WebSocketSharp
}
}
if (res.IsRedirect) {
var url = res.Headers["Location"];
_logger.Warn (
String.Format (
"Received a Redirect response that specifies the Location to '{0}'.", url));
}
return res;
}