using System;
using System.Net;
using System.Net.Cache;
using System.Net.Http;
namespace MediaBrowser.ServerApplication.Native
{
///
/// Class HttpClientFactory
///
public static class HttpClientFactory
{
///
/// Gets the HTTP client.
///
/// if set to true [enable HTTP compression].
/// HttpClient.
public static HttpClient GetHttpClient(bool enableHttpCompression)
{
return new HttpClient(new WebRequestHandler
{
CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate),
AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None
})
{
Timeout = TimeSpan.FromSeconds(20)
};
}
}
}