mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-27 18:10:54 +01:00
refactor http client factory for mono
This commit is contained in:
@@ -81,9 +81,9 @@
|
||||
<Compile Include="..\MediaBrowser.ServerApplication\ApplicationHost.cs">
|
||||
<Link>ApplicationHost.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Native\HttpMessageHandlerFactory.cs" />
|
||||
<Compile Include="Native\Assemblies.cs" />
|
||||
<Compile Include="Native\NativeApp.cs" />
|
||||
<Compile Include="Native\HttpClientFactory.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
||||
24
MediaBrowser.Server.Mono/Native/HttpClientFactory.cs
Normal file
24
MediaBrowser.Server.Mono/Native/HttpClientFactory.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
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)
|
||||
{
|
||||
return new HttpClient()
|
||||
{
|
||||
Timeout = TimeSpan.FromSeconds(20)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace MediaBrowser.ServerApplication.Native
|
||||
{
|
||||
/// <summary>
|
||||
/// Class HttpMessageHandlerFactory
|
||||
/// </summary>
|
||||
public static class HttpMessageHandlerFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the HTTP message handler.
|
||||
/// </summary>
|
||||
/// <param name="enableHttpCompression">if set to <c>true</c> [enable HTTP compression].</param>
|
||||
/// <returns>HttpMessageHandler.</returns>
|
||||
public static HttpMessageHandler GetHttpMessageHandler(bool enableHttpCompression)
|
||||
{
|
||||
return new HttpClientHandler
|
||||
{
|
||||
AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user