[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) 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)