From 7e67cf540cab1131536d7067eeb570cf83828648 Mon Sep 17 00:00:00 2001 From: sta Date: Sun, 18 Feb 2018 17:41:55 +0900 Subject: [PATCH] [Modify] Use it --- websocket-sharp/Net/HttpListenerRequest.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/websocket-sharp/Net/HttpListenerRequest.cs b/websocket-sharp/Net/HttpListenerRequest.cs index 0c5e73a8..0d43189a 100644 --- a/websocket-sharp/Net/HttpListenerRequest.cs +++ b/websocket-sharp/Net/HttpListenerRequest.cs @@ -706,18 +706,18 @@ namespace WebSocketSharp.Net internal void FinishInitialization () { - if (_protocolVersion > HttpVersion.Version10 && !_userHostNameSet) { - _context.ErrorMessage = "No Host header"; + if (_protocolVersion == HttpVersion.Version10) { + finishInitialization10 (); + return; + } + + if (_userHostName == null) { + _context.ErrorMessage = "Host header required"; return; } var transferEnc = _headers["Transfer-Encoding"]; if (transferEnc != null) { - if (_protocolVersion < HttpVersion.Version11) { - _context.ErrorMessage = "Invalid Transfer-Encoding header"; - return; - } - var comparison = StringComparison.OrdinalIgnoreCase; if (!transferEnc.Equals ("chunked", comparison)) { _context.ErrorMessage = String.Empty; @@ -729,8 +729,8 @@ namespace WebSocketSharp.Net _chunked = true; } - if (_contentLength == -1 && !_chunked) { - if (_httpMethod == "POST" || _httpMethod == "PUT") { + if (_httpMethod == "POST" || _httpMethod == "PUT") { + if (_contentLength <= 0 && !_chunked) { _context.ErrorMessage = String.Empty; _context.ErrorStatus = 411; @@ -739,7 +739,7 @@ namespace WebSocketSharp.Net } var expect = _headers["Expect"]; - if (_protocolVersion > HttpVersion.Version10 && expect != null) { + if (expect != null) { var comparison = StringComparison.OrdinalIgnoreCase; if (!expect.Equals ("100-continue", comparison)) { _context.ErrorMessage = "Invalid Expect header";