|
|
@ -133,7 +133,7 @@ namespace NzbDrone.Common.Http
|
|
|
|
response = interceptor.PostResponse(response);
|
|
|
|
response = interceptor.PostResponse(response);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (request.LogResponseContent)
|
|
|
|
if (request.LogResponseContent && response.ResponseData != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.Trace("Response content ({0} bytes): {1}", response.ResponseData.Length, response.Content);
|
|
|
|
_logger.Trace("Response content ({0} bytes): {1}", response.ResponseData.Length, response.Content);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -242,9 +242,19 @@ namespace NzbDrone.Common.Http
|
|
|
|
_logger.Debug("Downloading [{0}] to [{1}]", url, fileName);
|
|
|
|
_logger.Debug("Downloading [{0}] to [{1}]", url, fileName);
|
|
|
|
|
|
|
|
|
|
|
|
var stopWatch = Stopwatch.StartNew();
|
|
|
|
var stopWatch = Stopwatch.StartNew();
|
|
|
|
var webClient = new GZipWebClient();
|
|
|
|
using (var fileStream = new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite))
|
|
|
|
webClient.Headers.Add(HttpRequestHeader.UserAgent, userAgent ?? _userAgentBuilder.GetUserAgent());
|
|
|
|
{
|
|
|
|
webClient.DownloadFile(url, fileName);
|
|
|
|
var request = new HttpRequest(url);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (userAgent.IsNotNullOrWhiteSpace())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
request.Headers.Set("User-Agent", userAgent);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
request.ResponseStream = fileStream;
|
|
|
|
|
|
|
|
var response = Get(request);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
stopWatch.Stop();
|
|
|
|
stopWatch.Stop();
|
|
|
|
_logger.Debug("Downloading Completed. took {0:0}s", stopWatch.Elapsed.Seconds);
|
|
|
|
_logger.Debug("Downloading Completed. took {0:0}s", stopWatch.Elapsed.Seconds);
|
|
|
|
}
|
|
|
|
}
|
|
|
|