diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-05-06 22:28:19 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-05-06 22:28:19 -0400 |
| commit | 0d025f7fb620bf2a24ca9aa4e5994f132e02e7c0 (patch) | |
| tree | 76137f5f868ed81725d29bbdc6ac0e3b57c304d8 /MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | |
| parent | e1dd361c7bf05af49d9210ab679e85fa00870990 (diff) | |
beginning remote subtitle downloading
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs')
| -rw-r--r-- | MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index a88f457c5..0a9f0ff8a 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -114,9 +114,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.AutomaticDecompression = enableHttpCompression ? DecompressionMethods.Deflate : DecompressionMethods.None; - request.CachePolicy = options.CachePolicy == Net.HttpRequestCachePolicy.None ? - new RequestCachePolicy(RequestCacheLevel.BypassCache) : - new RequestCachePolicy(RequestCacheLevel.Revalidate); + request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); request.ConnectionGroupName = GetHostFromUrl(options.Url); request.KeepAlive = true; @@ -124,6 +122,11 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.Pipelined = true; request.Timeout = 20000; + if (!string.IsNullOrEmpty(options.Host)) + { + request.Host = options.Host; + } + #if !__MonoCS__ // This is a hack to prevent KeepAlive from getting disabled internally by the HttpWebRequest // May need to remove this for mono @@ -234,9 +237,11 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager !string.IsNullOrEmpty(options.RequestContent) || string.Equals(httpMethod, "post", StringComparison.OrdinalIgnoreCase)) { - var bytes = options.RequestContentBytes ?? Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty); + var bytes = options.RequestContentBytes ?? + Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty); httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded"; + httpWebRequest.ContentLength = bytes.Length; httpWebRequest.GetRequestStream().Write(bytes, 0, bytes.Length); } |
