|
|
|
@ -672,6 +672,11 @@ namespace WebSocketSharp
|
|
|
|
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
|
|
|
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!customCheckIfValidHandshakeRequest (_context, out msg)) {
|
|
|
|
|
|
|
|
sendHttpResponse (createHandshakeCloseResponse (HttpStatusCode.BadRequest));
|
|
|
|
|
|
|
|
throw new WebSocketException (CloseStatusCode.PolicyViolation, msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (_protocol != null
|
|
|
|
if (_protocol != null
|
|
|
|
&& !_context.SecWebSocketProtocols.Contains (protocol => protocol == _protocol)
|
|
|
|
&& !_context.SecWebSocketProtocols.Contains (protocol => protocol == _protocol)
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
@ -723,10 +728,6 @@ namespace WebSocketSharp
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message = CustomHandshakeRequestChecker (context);
|
|
|
|
|
|
|
|
if (message != null)
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -984,6 +985,14 @@ namespace WebSocketSharp
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// As server
|
|
|
|
|
|
|
|
private bool customCheckIfValidHandshakeRequest (WebSocketContext context, out string message)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
message = null;
|
|
|
|
|
|
|
|
return _handshakeRequestChecker == null
|
|
|
|
|
|
|
|
|| (message = _handshakeRequestChecker (context)) == null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MessageEventArgs dequeueFromMessageEventQueue ()
|
|
|
|
private MessageEventArgs dequeueFromMessageEventQueue ()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lock (_forMessageEventQueue)
|
|
|
|
lock (_forMessageEventQueue)
|
|
|
|
|