mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-02 08:21:56 +01:00
switch from httpclient to plain httpwebrequest
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Cache;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace MediaBrowser.ServerApplication.Native
|
||||
{
|
||||
/// <summary>
|
||||
/// Class HttpClientFactory
|
||||
/// </summary>
|
||||
public static class HttpClientFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the HTTP client.
|
||||
/// </summary>
|
||||
/// <param name="enableHttpCompression">if set to <c>true</c> [enable HTTP compression].</param>
|
||||
/// <returns>HttpClient.</returns>
|
||||
public static HttpClient GetHttpClient(bool enableHttpCompression)
|
||||
{
|
||||
var client = new HttpClient(new WebRequestHandler
|
||||
{
|
||||
CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate),
|
||||
AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None
|
||||
|
||||
})
|
||||
{
|
||||
Timeout = TimeSpan.FromSeconds(20)
|
||||
};
|
||||
|
||||
client.DefaultRequestHeaders.Add("Connection", "Keep-Alive");
|
||||
|
||||
return client;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user