[Modify] Replace it
This commit is contained in:
parent
7987622cc0
commit
80efd30b93
@ -2814,8 +2814,14 @@ namespace WebSocketSharp
|
|||||||
public void SetCredentials (string username, string password, bool preAuth)
|
public void SetCredentials (string username, string password, bool preAuth)
|
||||||
{
|
{
|
||||||
lock (_forConn) {
|
lock (_forConn) {
|
||||||
var msg = checkIfAvailable (true, false, true, false, false, true);
|
string msg;
|
||||||
if (msg == null) {
|
if (!checkIfAvailable (true, false, true, false, false, true, out msg)) {
|
||||||
|
_logger.Error (msg);
|
||||||
|
error ("An error has occurred in setting the credentials.", null);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (username.IsNullOrEmpty ()) {
|
if (username.IsNullOrEmpty ()) {
|
||||||
_credentials = null;
|
_credentials = null;
|
||||||
_preAuth = false;
|
_preAuth = false;
|
||||||
@ -2824,15 +2830,15 @@ namespace WebSocketSharp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = username.Contains (':') || !username.IsText ()
|
if (username.Contains (':') || !username.IsText ()) {
|
||||||
? "'username' contains an invalid character."
|
_logger.Error ("'username' contains an invalid character.");
|
||||||
: !password.IsNullOrEmpty () && !password.IsText ()
|
error ("An error has occurred in setting the credentials.", null);
|
||||||
? "'password' contains an invalid character."
|
|
||||||
: null;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg != null) {
|
if (!password.IsNullOrEmpty () && !password.IsText ()) {
|
||||||
_logger.Error (msg);
|
_logger.Error ("'password' contains an invalid character.");
|
||||||
error ("An error has occurred in setting the credentials.", null);
|
error ("An error has occurred in setting the credentials.", null);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user