void SetupRequest (HttpRequestMessage request, CFHTTPMessage message) { string accept_encoding = null; if ((AutomaticDecompression & DecompressionMethods.GZip) != 0) accept_encoding = "gzip"; if ((AutomaticDecompression & DecompressionMethods.Deflate) != 0) accept_encoding = accept_encoding != null ? "gzip, deflate" : "deflate"; if (accept_encoding != null) message.SetHeaderFieldValue ("Accept-Encoding", accept_encoding); if (request.Content != null) { foreach (var header in request.Content.Headers) { var value = string.Join (",", header.Value); message.SetHeaderFieldValue (header.Key, value); } } foreach (var header in request.Headers) { if ((accept_encoding != null) && header.Key.Equals ("Accept-Encoding")) continue; var value = string.Join (",", header.Value); message.SetHeaderFieldValue (header.Key, value); } if (UseCookies && (CookieContainer != null)) { string cookieHeader = CookieContainer.GetCookieHeader (request.RequestUri); if (cookieHeader != "") message.SetHeaderFieldValue ("Cookie", cookieHeader); } }