mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-24 07:30:57 +01:00
ipv6 update
This commit is contained in:
parent
1a72e3b596
commit
22730746eb
3 changed files with 23 additions and 1 deletions
|
|
@ -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)
|
||||
{
|
||||
var request = CreateWebRequest(options.Url);
|
||||
|
|
@ -133,6 +150,8 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
|
|||
|
||||
if (httpWebRequest != null)
|
||||
{
|
||||
AddIpv4Option(httpWebRequest, options);
|
||||
|
||||
AddRequestHeaders(httpWebRequest, options);
|
||||
|
||||
httpWebRequest.AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue