[Modify] Replace it

This commit is contained in:
sta 2016-01-30 16:11:34 +09:00
parent dcc56fa071
commit eaaba53442

View File

@ -677,11 +677,8 @@ namespace WebSocketSharp
throw new WebSocketException (CloseStatusCode.PolicyViolation, msg); throw new WebSocketException (CloseStatusCode.PolicyViolation, msg);
} }
if (_protocol != null if (_protocol != null)
&& !_context.SecWebSocketProtocols.Contains (protocol => protocol == _protocol) processSecWebSocketProtocolHeader (_context.SecWebSocketProtocols);
) {
_protocol = null;
}
if (!_ignoreExtensions) if (!_ignoreExtensions)
processSecWebSocketExtensionsHeader (_context.Headers["Sec-WebSocket-Extensions"]); processSecWebSocketExtensionsHeader (_context.Headers["Sec-WebSocket-Extensions"]);
@ -1257,6 +1254,15 @@ namespace WebSocketSharp
} }
} }
// As server
private void processSecWebSocketProtocolHeader (IEnumerable<string> values)
{
if (values.Contains (p => p == _protocol))
return;
_protocol = null;
}
private bool processUnsupportedFrame (WebSocketFrame frame) private bool processUnsupportedFrame (WebSocketFrame frame)
{ {
_logger.Fatal ("An unsupported frame:" + frame.PrintToString (false)); _logger.Fatal ("An unsupported frame:" + frame.PrintToString (false));