diff options
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs')
| -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..89d00b87d 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()) |
