diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-06-30 15:27:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-06-30 15:27:06 -0400 |
| commit | 2708df6cc28c48a89416bdfbdde7e78fc4227c62 (patch) | |
| tree | 9f892d6350a4d694c96985d679f622c0f7005278 /MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | |
| parent | d9406d48ca0231bc096aeadc595c30f0596c8dda (diff) | |
| parent | 5bdc96bb6a9b863980661e2d11c1ad00a02eb601 (diff) | |
Merge pull request #1899 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index f9dbd766f..5c70179a8 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -128,11 +128,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager private void AddIpv4Option(HttpWebRequest request, HttpRequestOptions options) { - if (!options.PreferIpv4) - { - return; - } - request.ServicePoint.BindIPEndPointDelegate = (servicePount, remoteEndPoint, retryCount) => { if (remoteEndPoint.AddressFamily == AddressFamily.InterNetwork) @@ -143,18 +138,23 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager }; } - private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression) + private WebRequest GetRequest(HttpRequestOptions options, string method) { var request = CreateWebRequest(options.Url); var httpWebRequest = request as HttpWebRequest; if (httpWebRequest != null) { - AddIpv4Option(httpWebRequest, options); + if (options.PreferIpv4) + { + AddIpv4Option(httpWebRequest, options); + } AddRequestHeaders(httpWebRequest, options); - httpWebRequest.AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None; + httpWebRequest.AutomaticDecompression = options.EnableHttpCompression ? + (options.DecompressionMethod ?? DecompressionMethods.Deflate) : + DecompressionMethods.None; } request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); @@ -366,7 +366,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager }; } - var httpWebRequest = GetRequest(options, httpMethod, options.EnableHttpCompression); + var httpWebRequest = GetRequest(options, httpMethod); if (options.RequestContentBytes != null || !string.IsNullOrEmpty(options.RequestContent) || @@ -556,7 +556,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager options.CancellationToken.ThrowIfCancellationRequested(); - var httpWebRequest = GetRequest(options, "GET", options.EnableHttpCompression); + var httpWebRequest = GetRequest(options, "GET"); if (options.ResourcePool != null) { |
