diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-12-01 07:43:34 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-12-01 07:43:34 -0500 |
| commit | dc8fb33a1f5ad474fed88d58a19c1098c68b815f (patch) | |
| tree | f25dbe0019c0ee3f872d3c7d57ac70bed2076b33 /MediaBrowser.Common.Implementations/HttpClientManager | |
| parent | d7bdb744ca9d4b3955071dfe3c38ed631dbafbfd (diff) | |
updated nuget
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager')
| -rw-r--r-- | MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 900009a23..78b0b1389 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Configuration; +using System.Net.Sockets; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; @@ -134,9 +135,22 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.Referer = options.Referer; } + request.ServicePoint.BindIPEndPointDelegate = BindIPEndPointCallback; + return request; } + private static IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) + { + // Prefer local ipv4 + if (remoteEndPoint.AddressFamily == AddressFamily.InterNetworkV6) + { + return new IPEndPoint(IPAddress.IPv6Any, 0); + } + + return new IPEndPoint(IPAddress.Any, 0); + } + private void AddRequestHeaders(HttpWebRequest request, HttpRequestOptions options) { foreach (var header in options.RequestHeaders.ToList()) |
