[Modify] Polish it

This commit is contained in:
sta 2018-07-05 20:38:26 +09:00
parent eedd814429
commit 9351245a32

View File

@ -366,12 +366,19 @@ namespace WebSocketSharp.Server
private string checkHandshakeRequest (WebSocketContext context)
{
return _originValidator != null && !_originValidator (context.Origin)
? "Includes no Origin header, or it has an invalid value."
: _cookiesValidator != null
&& !_cookiesValidator (context.CookieCollection, context.WebSocket.CookieCollection)
? "Includes no cookie, or an invalid cookie exists."
: null;
if (_originValidator != null) {
if (!_originValidator (context.Origin))
return "It includes no Origin header or an invalid one.";
}
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)