diff --git a/websocket-sharp/Net/EndPointListener.cs b/websocket-sharp/Net/EndPointListener.cs index 67fa26393..0b847f1c9 100644 --- a/websocket-sharp/Net/EndPointListener.cs +++ b/websocket-sharp/Net/EndPointListener.cs @@ -351,7 +351,7 @@ internal bool TrySearchHttpListener (Uri uri, out HttpListener listener) continue; } - if (pref.Port != port) + if (pref.Port != port && !_prefixes[pref].AllowForwardedRequest) continue; var prefPath = pref.Path; diff --git a/websocket-sharp/Net/HttpListener.cs b/websocket-sharp/Net/HttpListener.cs index 07970e14d..683bb1497 100644 --- a/websocket-sharp/Net/HttpListener.cs +++ b/websocket-sharp/Net/HttpListener.cs @@ -61,6 +61,7 @@ public sealed class HttpListener : IDisposable { #region Private Fields + private bool _allowForwardedRequest; private AuthenticationSchemes _authSchemes; private Func _authSchemeSelector; private string _certFolderPath; @@ -144,6 +145,29 @@ internal bool ReuseAddress { #region Public Properties + /// + /// Gets or sets a value indicating whether the server accepts every + /// handshake request without checking the request URI. + /// + /// + /// The set operation does nothing if the server has already started or + /// it is shutting down. + /// + /// + /// + /// true if the server accepts every handshake request without + /// checking the request URI; otherwise, false. + /// + /// + /// The default value is false. + /// + /// + public bool AllowForwardedRequest + { + get { return _allowForwardedRequest; } + set { _allowForwardedRequest = value; } + } + /// /// Gets or sets the scheme used to authenticate the clients. /// diff --git a/websocket-sharp/Server/HttpServer.cs b/websocket-sharp/Server/HttpServer.cs index 83de8555c..2b8f299d5 100644 --- a/websocket-sharp/Server/HttpServer.cs +++ b/websocket-sharp/Server/HttpServer.cs @@ -307,6 +307,29 @@ public System.Net.IPAddress Address { } } + /// + /// Gets or sets a value indicating whether the server accepts every + /// handshake request without checking the request URI. + /// + /// + /// The set operation does nothing if the server has already started or + /// it is shutting down. + /// + /// + /// + /// true if the server accepts every handshake request without + /// checking the request URI; otherwise, false. + /// + /// + /// The default value is false. + /// + /// + public bool AllowForwardedRequest + { + get { return _listener.AllowForwardedRequest; } + set { _listener.AllowForwardedRequest = value; } + } + /// /// Gets or sets the scheme used to authenticate the clients. ///