private static void AssignCommonHttpHeaders()

in AdlsDotNetSDK/WebTransport.cs [279:325]


        private static void AssignCommonHttpHeaders(HttpWebRequest webReq, AdlsClient client, RequestOptions req, string token, string opMethod, IDictionary<string, string> customHeaders, int postRequestLength)
        {

            webReq.Headers["Authorization"] = token;
            string latencyHeader = LatencyTracker.GetLatency();
            if (!string.IsNullOrEmpty(latencyHeader))
            {
                webReq.Headers["x-ms-adl-client-latency"] = latencyHeader;
            }

            if (client.ContentEncoding != null && postRequestLength > MinDataSizeForCompression)
            {

                webReq.Headers["Content-Encoding"] = client.ContentEncoding;

            }

            if (client.DipIp != null && !req.IgnoreDip)
            {
                webReq.Host = client.AccountFQDN;
            }

            if (!req.KeepAlive)
            {
                webReq.KeepAlive = false;
            }

            if (customHeaders != null)
            {
                string contentType;
                if (customHeaders.TryGetValue("Content-Type", out contentType))
                {
                    webReq.ContentType = contentType;
                }
                foreach (var key in customHeaders.Keys)
                {
                    if (!HeadersNotToBeCopied.Contains(key))
                        webReq.Headers[key] = customHeaders[key];
                }
            }
            webReq.UserAgent = client.GetUserAgent();
            webReq.ServicePoint.UseNagleAlgorithm = false;
            webReq.ServicePoint.Expect100Continue = false;

            webReq.Headers["x-ms-client-request-id"] = req.RequestId;
            webReq.Method = opMethod;
        }