private void HandleInitialBytes(byte[] initialbytes, int splitmark) { List<byte[]> split = http_function.SplitHeaderBody(initialbytes,splitmark); if(_header == null) _header = new http_header(split[0]); else _header.Initialize(split[0]); if (HeaderFound != null) { HeaderFound(this, new EventArgs()); } if(_disable_accept_encoding) _header.AcceptEncoding = "identity"; byte[] body = split[1]; if (body.Length > 0 && _cancel == false) { SetupCacheFile(); AppendBytesToFile(split[1]); } }
public static HttpUri BuildUriFromHeader(http_header _header, bool secure) { string protocol = "http://"; if (secure) protocol = "https://"; string host = ""; string pathandquery = ""; if (_header.Verb == "CONNECT") { protocol = "https://"; host = _header.Target; } else { host = _header.Host; pathandquery = _header.Target; } pathandquery = pathandquery.Replace(".","%2E"); string url = string.Format("{0}{1}{2}", protocol, host, pathandquery); return new HttpUri(url); }
public http_request() { _header = new http_header(new byte[0]); _body = new MemoryStream(); }