Fix a few for WebSocket.cs
This commit is contained in:
parent
87068bc4f3
commit
12b4af3628
@ -511,26 +511,22 @@ namespace WebSocketSharp
|
||||
return true;
|
||||
}
|
||||
|
||||
private void acceptException (Exception exception, string reason)
|
||||
private void acceptException (Exception exception, string message)
|
||||
{
|
||||
var code = CloseStatusCode.Abnormal;
|
||||
var msg = reason;
|
||||
var reason = message;
|
||||
if (exception is WebSocketException) {
|
||||
var wsex = (WebSocketException) exception;
|
||||
code = wsex.Code;
|
||||
reason = wsex.Message;
|
||||
}
|
||||
|
||||
if (code == CloseStatusCode.Abnormal || code == CloseStatusCode.TlsHandshakeFailure) {
|
||||
if (code == CloseStatusCode.Abnormal || code == CloseStatusCode.TlsHandshakeFailure)
|
||||
_logger.Fatal (exception.ToString ());
|
||||
reason = msg;
|
||||
}
|
||||
else {
|
||||
else
|
||||
_logger.Error (reason);
|
||||
msg = null;
|
||||
}
|
||||
|
||||
error (msg ?? code.GetMessage ());
|
||||
error (message ?? code.GetMessage ());
|
||||
if (_readyState == WebSocketState.Connecting && !_client)
|
||||
Close (HttpStatusCode.BadRequest);
|
||||
else
|
||||
@ -2031,8 +2027,8 @@ namespace WebSocketSharp
|
||||
len));
|
||||
|
||||
var sent = len <= FragmentLength
|
||||
? send (Opcode.Binary, data)
|
||||
: send (Opcode.Binary, new MemoryStream (data));
|
||||
? send (Opcode.Binary, data)
|
||||
: send (Opcode.Binary, new MemoryStream (data));
|
||||
|
||||
if (completed != null)
|
||||
completed (sent);
|
||||
@ -2098,10 +2094,10 @@ namespace WebSocketSharp
|
||||
}
|
||||
|
||||
msg = username.Contains (':') || !username.IsText ()
|
||||
? "'username' contains an invalid character."
|
||||
: !password.IsNullOrEmpty () && !password.IsText ()
|
||||
? "'password' contains an invalid character."
|
||||
: null;
|
||||
? "'username' contains an invalid character."
|
||||
: !password.IsNullOrEmpty () && !password.IsText ()
|
||||
? "'password' contains an invalid character."
|
||||
: null;
|
||||
}
|
||||
|
||||
if (msg != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user