fixed http get method

This commit is contained in:
Luke Pulverenti 2013-04-20 22:32:12 -04:00
parent 2e358a5968
commit 0984474c17

View file

@ -92,7 +92,8 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
{ {
var handler = new WebRequestHandler var handler = new WebRequestHandler
{ {
CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache) CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache),
AutomaticDecompression = DecompressionMethods.None
}; };
client = new HttpClient(handler); client = new HttpClient(handler);
@ -163,28 +164,27 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
{ {
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
using (var response = await GetHttpClient(GetHostFromUrl(url)).SendAsync(message, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false)) var response = await GetHttpClient(GetHostFromUrl(url)).SendAsync(message, HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
{
EnsureSuccessStatusCode(response);
cancellationToken.ThrowIfCancellationRequested(); EnsureSuccessStatusCode(response);
//cachedInfo = UpdateInfoCache(cachedInfo, url, infoPath, response); cancellationToken.ThrowIfCancellationRequested();
//if (response.StatusCode == HttpStatusCode.NotModified) //cachedInfo = UpdateInfoCache(cachedInfo, url, infoPath, response);
//{
// return GetCachedResponse(responsePath);
//}
//if (!string.IsNullOrEmpty(cachedInfo.Etag) || cachedInfo.LastModified.HasValue || (cachedInfo.Expires.HasValue && cachedInfo.Expires.Value > DateTime.UtcNow)) //if (response.StatusCode == HttpStatusCode.NotModified)
//{ //{
// await UpdateResponseCache(response, responsePath).ConfigureAwait(false); // 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) catch (OperationCanceledException ex)
{ {