ipv6 update
This commit is contained in:
parent
1a72e3b596
commit
22730746eb
|
@ -126,6 +126,23 @@ 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)
|
||||||
|
{
|
||||||
|
return new IPEndPoint(IPAddress.Any, 0);
|
||||||
|
}
|
||||||
|
throw new InvalidOperationException("no IPv4 address");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression)
|
private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression)
|
||||||
{
|
{
|
||||||
var request = CreateWebRequest(options.Url);
|
var request = CreateWebRequest(options.Url);
|
||||||
|
@ -133,6 +150,8 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
||||||
|
|
||||||
if (httpWebRequest != null)
|
if (httpWebRequest != null)
|
||||||
{
|
{
|
||||||
|
AddIpv4Option(httpWebRequest, options);
|
||||||
|
|
||||||
AddRequestHeaders(httpWebRequest, options);
|
AddRequestHeaders(httpWebRequest, options);
|
||||||
|
|
||||||
httpWebRequest.AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None;
|
httpWebRequest.AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None;
|
||||||
|
|
|
@ -96,6 +96,7 @@ namespace MediaBrowser.Common.Net
|
||||||
public TimeSpan CacheLength { get; set; }
|
public TimeSpan CacheLength { get; set; }
|
||||||
|
|
||||||
public int TimeoutMs { get; set; }
|
public int TimeoutMs { get; set; }
|
||||||
|
public bool PreferIpv4 { get; set; }
|
||||||
|
|
||||||
private string GetHeaderValue(string name)
|
private string GetHeaderValue(string name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,9 @@ namespace MediaBrowser.Server.Implementations.Connect
|
||||||
LogErrors = logErrors,
|
LogErrors = logErrors,
|
||||||
|
|
||||||
// Seeing block length errors with our server
|
// Seeing block length errors with our server
|
||||||
EnableHttpCompression = false
|
EnableHttpCompression = false,
|
||||||
|
|
||||||
|
PreferIpv4 = true
|
||||||
|
|
||||||
}).ConfigureAwait(false))
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user