internal void FinishInitialization() { var host = _headers["Host"]; var noHost = host == null || host.Length == 0; if (_version > HttpVersion.Version10 && noHost) { _context.ErrorMessage = "Invalid Host header"; return; } if (noHost) { host = UserHostAddress; } _url = HttpUtility.CreateRequestUrl(_uri, host, IsWebSocketRequest, IsSecureConnection); if (_url == null) { _context.ErrorMessage = "Invalid request url"; return; } var enc = Headers["Transfer-Encoding"]; if (_version > HttpVersion.Version10 && enc != null && enc.Length > 0) { _chunked = enc.ToLower() == "chunked"; if (!_chunked) { _context.ErrorMessage = String.Empty; _context.ErrorStatus = 501; return; } } if (!_chunked && !_contentLengthWasSet) { var method = _method.ToLower(); if (method == "post" || method == "put") { _context.ErrorMessage = String.Empty; _context.ErrorStatus = 411; return; } } var expect = Headers["Expect"]; if (expect != null && expect.Length > 0 && expect.ToLower() == "100-continue") { var output = _context.Connection.GetResponseStream(); output.WriteInternally(_100continue, 0, _100continue.Length); } }
internal void FinishInitialization() { string item = this._headers["Host"]; bool flag = (item == null ? true : item.Length == 0); if (!((this._version > WebSocketSharp.Net.HttpVersion.Version10) & flag)) { if (flag) { item = this.UserHostAddress; } this._url = HttpUtility.CreateRequestUrl(this._uri, item, this.IsWebSocketRequest, this.IsSecureConnection); if (this._url != null) { string str = this.Headers["Transfer-Encoding"]; if ((!(this._version > WebSocketSharp.Net.HttpVersion.Version10) || str == null ? false : str.Length > 0)) { this._chunked = str.ToLower() == "chunked"; if (!this._chunked) { this._context.ErrorMessage = string.Empty; this._context.ErrorStatus = 501; return; } } if ((this._chunked ? false : !this._contentLengthSet)) { string lower = this._method.ToLower(); if ((lower == "post" ? true : lower == "put")) { this._context.ErrorMessage = string.Empty; this._context.ErrorStatus = 411; return; } } string item1 = this.Headers["Expect"]; if ((item1 == null || item1.Length <= 0 ? false : item1.ToLower() == "100-continue")) { ResponseStream responseStream = this._context.Connection.GetResponseStream(); responseStream.InternalWrite(WebSocketSharp.Net.HttpListenerRequest._100continue, 0, (int)WebSocketSharp.Net.HttpListenerRequest._100continue.Length); } } else { this._context.ErrorMessage = "Invalid request url"; } } else { this._context.ErrorMessage = "Invalid Host header"; } }
internal void FinishInitialization() { string host = this._headers["Host"]; bool flag = (host == null) || (host.Length == 0); if ((this._version > HttpVersion.Version10) && flag) { this._context.ErrorMessage = "Invalid Host header"; } else { if (flag) { host = this.UserHostAddress; } this._url = HttpUtility.CreateRequestUrl(this._uri, host, this.IsWebSocketRequest, this.IsSecureConnection); if (this._url == null) { this._context.ErrorMessage = "Invalid request url"; } else { string str2 = this.Headers["Transfer-Encoding"]; if ((this._version > HttpVersion.Version10) && ((str2 != null) && (str2.Length > 0))) { this._chunked = str2.ToLower() == "chunked"; if (!this._chunked) { this._context.ErrorMessage = string.Empty; this._context.ErrorStatus = 0x1f5; return; } } if (!this._chunked && !this._contentLengthSet) { string str3 = this._method.ToLower(); if ((str3 == "post") || (str3 == "put")) { this._context.ErrorMessage = string.Empty; this._context.ErrorStatus = 0x19b; return; } } string str4 = this.Headers["Expect"]; if ((str4 != null) && ((str4.Length > 0) && (str4.ToLower() == "100-continue"))) { this._context.Connection.GetResponseStream().InternalWrite(_100continue, 0, _100continue.Length); } } } }
internal void FinishInitialization() { string text = _headers["Host"]; bool flag = text == null || text.Length == 0; if (_version > HttpVersion.Version10 && flag) { _context.ErrorMessage = "Invalid Host header"; return; } if (flag) { text = UserHostAddress; } _url = HttpUtility.CreateRequestUrl(_uri, text, IsWebSocketRequest, IsSecureConnection); if (_url == null) { _context.ErrorMessage = "Invalid request url"; return; } string text2 = Headers["Transfer-Encoding"]; if (_version > HttpVersion.Version10 && text2 != null && text2.Length > 0) { _chunked = text2.ToLower() == "chunked"; if (!_chunked) { _context.ErrorMessage = string.Empty; _context.ErrorStatus = 501; return; } } if (!_chunked && !_contentLengthWasSet) { string text3 = _method.ToLower(); if (text3 == "post" || text3 == "put") { _context.ErrorMessage = string.Empty; _context.ErrorStatus = 411; return; } } string text4 = Headers["Expect"]; if (text4 != null && text4.Length > 0 && text4.ToLower() == "100-continue") { ResponseStream responseStream = _context.Connection.GetResponseStream(); responseStream.WriteInternally(_100continue, 0, _100continue.Length); } }
internal void FinishInitialization() { var host = _headers["Host"]; var hasHost = host != null && host.Length > 0; if (_version > HttpVersion.Version10 && !hasHost) { _context.ErrorMessage = "Invalid Host header"; return; } _url = HttpUtility.CreateRequestUrl( _uri, hasHost ? host : UserHostAddress, IsWebSocketRequest, IsSecureConnection ); if (_url == null) { _context.ErrorMessage = "Invalid request url"; return; } var transferEnc = _headers["Transfer-Encoding"]; if (transferEnc != null) { if (_version < HttpVersion.Version11) { _context.ErrorMessage = "Invalid Transfer-Encoding header"; return; } var comparison = StringComparison.OrdinalIgnoreCase; if (!transferEnc.Equals("chunked", comparison)) { _context.ErrorMessage = String.Empty; _context.ErrorStatus = 501; return; } _chunked = true; } if (!_chunked && !_contentLengthSet) { if (_method == "POST" || _method == "PUT") { _context.ErrorMessage = String.Empty; _context.ErrorStatus = 411; return; } } var expect = _headers["Expect"]; if (_version > HttpVersion.Version10 && expect != null) { var comparison = StringComparison.OrdinalIgnoreCase; if (!expect.Equals("100-continue", comparison)) { _context.ErrorMessage = "Invalid Expect header"; return; } var output = _context.Connection.GetResponseStream(); output.InternalWrite(_100continue, 0, _100continue.Length); } }