diff --git a/websocket-sharp/Net/HttpListenerRequest.cs b/websocket-sharp/Net/HttpListenerRequest.cs index a9c30e9c..e25e40f8 100644 --- a/websocket-sharp/Net/HttpListenerRequest.cs +++ b/websocket-sharp/Net/HttpListenerRequest.cs @@ -582,15 +582,6 @@ namespace WebSocketSharp.Net private void finishInitialization10 () { - var validMethod = _httpMethod == "GET" - || _httpMethod == "HEAD" - || _httpMethod == "POST"; - - if (!validMethod) { - _context.ErrorMessage = "Invalid request line (method)"; - return; - } - if (_httpMethod == "POST") { if (_contentLength == -1) { _context.ErrorMessage = "Content-Length header required"; @@ -820,6 +811,11 @@ namespace WebSocketSharp.Net return; } + if (!method.IsHttpMethod (ver)) { + _context.ErrorMessage = "Invalid request line (method)"; + return; + } + _httpMethod = method; _rawUrl = target; _protocolVersion = ver;