[Modify] Separate it
This commit is contained in:
parent
00ea73f331
commit
aff6ffe6b2
@ -672,6 +672,11 @@ namespace WebSocketSharp
|
||||
throw new WebSocketException (CloseStatusCode.ProtocolError, msg);
|
||||
}
|
||||
|
||||
if (!customCheckIfValidHandshakeRequest (_context, out msg)) {
|
||||
sendHttpResponse (createHandshakeCloseResponse (HttpStatusCode.BadRequest));
|
||||
throw new WebSocketException (CloseStatusCode.PolicyViolation, msg);
|
||||
}
|
||||
|
||||
if (_protocol != null
|
||||
&& !_context.SecWebSocketProtocols.Contains (protocol => protocol == _protocol)
|
||||
) {
|
||||
@ -723,10 +728,6 @@ namespace WebSocketSharp
|
||||
return false;
|
||||
}
|
||||
|
||||
message = CustomHandshakeRequestChecker (context);
|
||||
if (message != null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -984,6 +985,14 @@ namespace WebSocketSharp
|
||||
return ret;
|
||||
}
|
||||
|
||||
// As server
|
||||
private bool customCheckIfValidHandshakeRequest (WebSocketContext context, out string message)
|
||||
{
|
||||
message = null;
|
||||
return _handshakeRequestChecker == null
|
||||
|| (message = _handshakeRequestChecker (context)) == null;
|
||||
}
|
||||
|
||||
private MessageEventArgs dequeueFromMessageEventQueue ()
|
||||
{
|
||||
lock (_forMessageEventQueue)
|
||||
|
Loading…
Reference in New Issue
Block a user