[Modify] Use it
This commit is contained in:
parent
9198ea6cf7
commit
7e67cf540c
@ -706,18 +706,18 @@ namespace WebSocketSharp.Net
|
|||||||
|
|
||||||
internal void FinishInitialization ()
|
internal void FinishInitialization ()
|
||||||
{
|
{
|
||||||
if (_protocolVersion > HttpVersion.Version10 && !_userHostNameSet) {
|
if (_protocolVersion == HttpVersion.Version10) {
|
||||||
_context.ErrorMessage = "No Host header";
|
finishInitialization10 ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_userHostName == null) {
|
||||||
|
_context.ErrorMessage = "Host header required";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var transferEnc = _headers["Transfer-Encoding"];
|
var transferEnc = _headers["Transfer-Encoding"];
|
||||||
if (transferEnc != null) {
|
if (transferEnc != null) {
|
||||||
if (_protocolVersion < HttpVersion.Version11) {
|
|
||||||
_context.ErrorMessage = "Invalid Transfer-Encoding header";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var comparison = StringComparison.OrdinalIgnoreCase;
|
var comparison = StringComparison.OrdinalIgnoreCase;
|
||||||
if (!transferEnc.Equals ("chunked", comparison)) {
|
if (!transferEnc.Equals ("chunked", comparison)) {
|
||||||
_context.ErrorMessage = String.Empty;
|
_context.ErrorMessage = String.Empty;
|
||||||
@ -729,8 +729,8 @@ namespace WebSocketSharp.Net
|
|||||||
_chunked = true;
|
_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.ErrorMessage = String.Empty;
|
||||||
_context.ErrorStatus = 411;
|
_context.ErrorStatus = 411;
|
||||||
|
|
||||||
@ -739,7 +739,7 @@ namespace WebSocketSharp.Net
|
|||||||
}
|
}
|
||||||
|
|
||||||
var expect = _headers["Expect"];
|
var expect = _headers["Expect"];
|
||||||
if (_protocolVersion > HttpVersion.Version10 && expect != null) {
|
if (expect != null) {
|
||||||
var comparison = StringComparison.OrdinalIgnoreCase;
|
var comparison = StringComparison.OrdinalIgnoreCase;
|
||||||
if (!expect.Equals ("100-continue", comparison)) {
|
if (!expect.Equals ("100-continue", comparison)) {
|
||||||
_context.ErrorMessage = "Invalid Expect header";
|
_context.ErrorMessage = "Invalid Expect header";
|
||||||
|
Loading…
Reference in New Issue
Block a user