diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-04-20 22:32:12 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-04-20 22:32:12 -0400 |
| commit | 0984474c17ee235a4f738b1187ccc6e623bca61a (patch) | |
| tree | 8d5c846716d139cf08a5eb4e445731257f6426ed /MediaBrowser.Common.Implementations/HttpClientManager | |
| parent | 2e358a5968375b952c7dab02730977f9952bd7d4 (diff) | |
fixed http get method
Diffstat (limited to 'MediaBrowser.Common.Implementations/HttpClientManager')
| -rw-r--r-- | MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index a8e5b3e79..c707209ea 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -92,7 +92,8 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager { var handler = new WebRequestHandler { - CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache) + CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache), + AutomaticDecompression = DecompressionMethods.None }; client = new HttpClient(handler); @@ -163,28 +164,27 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager { cancellationToken.ThrowIfCancellationRequested(); - using (var response = await GetHttpClient(GetHostFromUrl(url)).SendAsync(message, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false)) - { - EnsureSuccessStatusCode(response); + var response = await GetHttpClient(GetHostFromUrl(url)).SendAsync(message, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - cancellationToken.ThrowIfCancellationRequested(); + EnsureSuccessStatusCode(response); - //cachedInfo = UpdateInfoCache(cachedInfo, url, infoPath, response); + cancellationToken.ThrowIfCancellationRequested(); - //if (response.StatusCode == HttpStatusCode.NotModified) - //{ - // return GetCachedResponse(responsePath); - //} + //cachedInfo = UpdateInfoCache(cachedInfo, url, infoPath, response); - //if (!string.IsNullOrEmpty(cachedInfo.Etag) || cachedInfo.LastModified.HasValue || (cachedInfo.Expires.HasValue && cachedInfo.Expires.Value > DateTime.UtcNow)) - //{ - // await UpdateResponseCache(response, responsePath).ConfigureAwait(false); + //if (response.StatusCode == HttpStatusCode.NotModified) + //{ + // return GetCachedResponse(responsePath); + //} - // return GetCachedResponse(responsePath); - //} + //if (!string.IsNullOrEmpty(cachedInfo.Etag) || cachedInfo.LastModified.HasValue || (cachedInfo.Expires.HasValue && cachedInfo.Expires.Value > DateTime.UtcNow)) + //{ + // await UpdateResponseCache(response, responsePath).ConfigureAwait(false); - return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - } + // return GetCachedResponse(responsePath); + //} + + return await response.Content.ReadAsStreamAsync().ConfigureAwait(false); } catch (OperationCanceledException ex) { |
