Added some logs for the authentication

This commit is contained in:
sta 2014-12-22 14:57:52 +09:00
parent 47931c9a42
commit f090fa9d5d

View File

@ -1254,7 +1254,19 @@ namespace WebSocketSharp
var req = createHandshakeRequest ();
var res = sendHttpRequest (req, 90000);
if (res.IsUnauthorized) {
_authChallenge = res.AuthenticationChallenge;
var chal = res.Headers["WWW-Authenticate"];
_logger.Warn (String.Format ("Received an authentication requirement for '{0}'.", chal));
if (chal.IsNullOrEmpty ()) {
_logger.Error ("No authentication challenge is specified.");
return res;
}
_authChallenge = AuthenticationChallenge.Parse (chal);
if (_authChallenge == null) {
_logger.Error ("An invalid authentication challenge is specified.");
return res;
}
if (_credentials != null &&
(!_preAuth || _authChallenge.Scheme == AuthenticationSchemes.Digest)) {
if (res.HasConnectionClose) {