diff options
| author | 7illusions <z@7illusions.com> | 2014-08-30 19:06:58 +0200 |
|---|---|---|
| committer | 7illusions <z@7illusions.com> | 2014-08-30 19:06:58 +0200 |
| commit | 66ad1699e22029b605e17735e8d9450285d8748a (patch) | |
| tree | ffc92c88d24850b2f82b6b3a8bdd904a2ccc77a5 /MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | |
| parent | 34bc54263e886aae777a3537dc50a6535b51330a (diff) | |
| parent | 9d36f518182bc075c19d78084870f5115fa62d1e (diff) | |
Merge pull request #1 from MediaBrowser/master
Update to latest
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 5efb39cbc..11a5cdf08 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -107,7 +107,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager return client; } - private PropertyInfo _httpBehaviorPropertyInfo; private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression) { var request = (HttpWebRequest)WebRequest.Create(options.Url); @@ -118,7 +117,11 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); - request.KeepAlive = options.EnableKeepAlive; + if (options.EnableKeepAlive) + { + request.KeepAlive = true; + } + request.Method = method; request.Pipelined = true; request.Timeout = 20000; @@ -133,21 +136,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.Referer = options.Referer; } -#if !__MonoCS__ - if (options.EnableKeepAlive) - { - // This is a hack to prevent KeepAlive from getting disabled internally by the HttpWebRequest - // May need to remove this for mono - var sp = request.ServicePoint; - if (_httpBehaviorPropertyInfo == null) - { - _httpBehaviorPropertyInfo = sp.GetType().GetProperty("HttpBehaviour", BindingFlags.Instance | BindingFlags.NonPublic); - } - - _httpBehaviorPropertyInfo.SetValue(sp, (byte)0, null); - } -#endif - return request; } |
