mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
27 lines
891 B
C#
27 lines
891 B
C#
using System.Net;
|
|
using System.Net.Cache;
|
|
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 WebRequestHandler
|
|
{
|
|
CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate),
|
|
AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None
|
|
};
|
|
}
|
|
}
|
|
}
|