[Modify] Only support HTTP/1.1

This commit is contained in:
sta 2021-01-22 19:47:29 +09:00
parent ddda8a444c
commit 3c9eb649e4

View File

@ -343,9 +343,7 @@ namespace WebSocketSharp.Net
/// </value> /// </value>
public bool IsWebSocketRequest { public bool IsWebSocketRequest {
get { get {
return _httpMethod == "GET" return _httpMethod == "GET" && _headers.Upgrades ("websocket");
&& _protocolVersion > HttpVersion.Version10
&& _headers.Upgrades ("websocket");
} }
} }
@ -714,12 +712,6 @@ namespace WebSocketSharp.Net
internal void FinishInitialization () internal void FinishInitialization ()
{ {
if (_protocolVersion == HttpVersion.Version10) {
finishInitialization10 ();
return;
}
if (_userHostName == null) { if (_userHostName == null) {
_context.ErrorMessage = "Host header required"; _context.ErrorMessage = "Host header required";
@ -853,8 +845,9 @@ namespace WebSocketSharp.Net
return; return;
} }
if (ver.Major < 1) { if (ver != HttpVersion.Version11) {
_context.ErrorMessage = "Invalid request line (version)"; _context.ErrorMessage = "Invalid request line (version)";
_context.ErrorStatusCode = 505;
return; return;
} }