[Modify] Move it out

This commit is contained in:
sta 2016-08-11 16:59:55 +09:00
parent 32b3043a58
commit 296ede4c33

View File

@ -2818,6 +2818,22 @@ namespace WebSocketSharp
return;
}
if (!username.IsNullOrEmpty ()) {
if (username.Contains (':') || !username.IsText ()) {
_logger.Error ("'username' contains an invalid character.");
error ("An error has occurred in setting the credentials.", null);
return;
}
if (!password.IsNullOrEmpty () && !password.IsText ()) {
_logger.Error ("'password' contains an invalid character.");
error ("An error has occurred in setting the credentials.", null);
return;
}
}
lock (_forState) {
if (!checkIfAvailable (true, false, false, true, out msg)) {
_logger.Error (msg);
@ -2834,20 +2850,6 @@ namespace WebSocketSharp
return;
}
if (username.Contains (':') || !username.IsText ()) {
_logger.Error ("'username' contains an invalid character.");
error ("An error has occurred in setting the credentials.", null);
return;
}
if (!password.IsNullOrEmpty () && !password.IsText ()) {
_logger.Error ("'password' contains an invalid character.");
error ("An error has occurred in setting the credentials.", null);
return;
}
_credentials = new NetworkCredential (username, password, _uri.PathAndQuery);
_preAuth = preAuth;
}