// Constructors HttpWebResponse(Uri uri, string method, WebConnectionData data, CookieContainer container) { _uri = uri; _method = method; _webHeaders = data.Headers; _version = data.Version; _statusCode = (HttpStatusCode)data.StatusCode; _statusDescription = data.StatusDescription; _stream = data.Stream; _contentLength = -1; try { var cl = _webHeaders["Content-Length"]; if (String.IsNullOrEmpty(cl) || !Int64.TryParse(cl, out _contentLength)) _contentLength = -1; } catch (Exception) { _contentLength = -1; } if (container != null) { _cookieContainer = container; //FillCookiesAsync(); } #if false string content_encoding = webHeaders ["Content-Encoding"]; if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0) stream = new GZipStream (stream, CompressionMode.Decompress); else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) stream = new DeflateStream (stream, CompressionMode.Decompress); #endif }
internal static async Task<HttpWebResponse> CreateAsync(Uri uri, string method, WebConnectionData data, CookieContainer container) { var response = new HttpWebResponse(uri, method, data, container); if (null != container) await response.FillCookiesAsync().ConfigureAwait(false); return response; }