Added the WebSocketBehavior.IgnoreExtensions property, to ignore the extensions requested from the client

This commit is contained in:
sta
2015-04-15 17:03:16 +09:00
parent dac4a4a489
commit f5a1ce2c53
2 changed files with 37 additions and 3 deletions

View File

@@ -47,6 +47,7 @@ namespace WebSocketSharp.Server
private WebSocketContext _context;
private Func<CookieCollection, CookieCollection, bool> _cookiesValidator;
private string _id;
private bool _ignoreExtensions;
private Func<string, bool> _originValidator;
private string _protocol;
private WebSocketSessionManager _sessions;
@@ -159,6 +160,24 @@ namespace WebSocketSharp.Server
}
}
/// <summary>
/// Gets or sets a value indicating whether the WebSocket service ignores
/// the Sec-WebSocket-Extensions header included in a connection request.
/// </summary>
/// <value>
/// <c>true</c> if the WebSocket service ignores the extensions; otherwise, <c>false</c>.
/// The default value is <c>false</c>.
/// </value>
public bool IgnoreExtensions {
get {
return _ignoreExtensions;
}
set {
_ignoreExtensions = value;
}
}
/// <summary>
/// Gets or sets the delegate called to validate the Origin header included in a connection
/// request to the WebSocket service.
@@ -316,6 +335,7 @@ namespace WebSocketSharp.Server
_websocket = context.WebSocket;
_websocket.CustomHandshakeRequestChecker = checkIfValidConnectionRequest;
_websocket.IgnoreExtensions = _ignoreExtensions;
_websocket.Protocol = _protocol;
var waitTime = sessions.WaitTime;