diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-02 13:05:13 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-02 13:05:13 -0400 |
| commit | bb4c918bf8403b2058f5fbbf2c0b1943b4b5f327 (patch) | |
| tree | 1c14879511e69a5a989ccf95f2de491f5b3eb9d2 /MediaBrowser.ServerApplication/Native | |
| parent | 9f8a1b30a1ecec0af3c48bcb30e035938f93218c (diff) | |
refactor http client factory for mono
Diffstat (limited to 'MediaBrowser.ServerApplication/Native')
| -rw-r--r-- | MediaBrowser.ServerApplication/Native/HttpClientFactory.cs (renamed from MediaBrowser.ServerApplication/Native/HttpMessageHandlerFactory.cs) | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/MediaBrowser.ServerApplication/Native/HttpMessageHandlerFactory.cs b/MediaBrowser.ServerApplication/Native/HttpClientFactory.cs index 4bbcc9ea0..57f00ba03 100644 --- a/MediaBrowser.ServerApplication/Native/HttpMessageHandlerFactory.cs +++ b/MediaBrowser.ServerApplication/Native/HttpClientFactory.cs @@ -1,25 +1,29 @@ -using System.Net; +using System; +using System.Net; using System.Net.Cache; using System.Net.Http; namespace MediaBrowser.ServerApplication.Native { /// <summary> - /// Class HttpMessageHandlerFactory + /// Class HttpClientFactory /// </summary> - public static class HttpMessageHandlerFactory + public static class HttpClientFactory { /// <summary> - /// Gets the HTTP message handler. + /// Gets the HTTP client. /// </summary> /// <param name="enableHttpCompression">if set to <c>true</c> [enable HTTP compression].</param> - /// <returns>HttpMessageHandler.</returns> - public static HttpMessageHandler GetHttpMessageHandler(bool enableHttpCompression) + /// <returns>HttpClient.</returns> + public static HttpClient GetHttpClient(bool enableHttpCompression) { - return new WebRequestHandler + return new HttpClient(new WebRequestHandler { CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate), AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None + }) + { + Timeout = TimeSpan.FromSeconds(20) }; } } |
