[Modify] Polish it
This commit is contained in:
parent
eedd814429
commit
9351245a32
@ -366,12 +366,19 @@ namespace WebSocketSharp.Server
|
|||||||
|
|
||||||
private string checkHandshakeRequest (WebSocketContext context)
|
private string checkHandshakeRequest (WebSocketContext context)
|
||||||
{
|
{
|
||||||
return _originValidator != null && !_originValidator (context.Origin)
|
if (_originValidator != null) {
|
||||||
? "Includes no Origin header, or it has an invalid value."
|
if (!_originValidator (context.Origin))
|
||||||
: _cookiesValidator != null
|
return "It includes no Origin header or an invalid one.";
|
||||||
&& !_cookiesValidator (context.CookieCollection, context.WebSocket.CookieCollection)
|
}
|
||||||
? "Includes no cookie, or an invalid cookie exists."
|
|
||||||
: null;
|
if (_cookiesValidator != null) {
|
||||||
|
var req = context.CookieCollection;
|
||||||
|
var res = context.WebSocket.CookieCollection;
|
||||||
|
if (!_cookiesValidator (req, res))
|
||||||
|
return "It includes no cookie or an invalid one.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onClose (object sender, CloseEventArgs e)
|
private void onClose (object sender, CloseEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user