mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
New: Readarr 0.1
This commit is contained in:
@@ -16,7 +16,7 @@ namespace NzbDrone.Common.Http
|
||||
public interface IHttpClient
|
||||
{
|
||||
HttpResponse Execute(HttpRequest request);
|
||||
void DownloadFile(string url, string fileName);
|
||||
void DownloadFile(string url, string fileName, string userAgent = null);
|
||||
HttpResponse Get(HttpRequest request);
|
||||
HttpResponse<T> Get<T>(HttpRequest request)
|
||||
where T : new();
|
||||
@@ -229,7 +229,7 @@ namespace NzbDrone.Common.Http
|
||||
}
|
||||
}
|
||||
|
||||
public void DownloadFile(string url, string fileName)
|
||||
public void DownloadFile(string url, string fileName, string userAgent = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -243,7 +243,7 @@ namespace NzbDrone.Common.Http
|
||||
|
||||
var stopWatch = Stopwatch.StartNew();
|
||||
var webClient = new GZipWebClient();
|
||||
webClient.Headers.Add(HttpRequestHeader.UserAgent, _userAgentBuilder.GetUserAgent());
|
||||
webClient.Headers.Add(HttpRequestHeader.UserAgent, userAgent ?? _userAgentBuilder.GetUserAgent());
|
||||
webClient.DownloadFile(url, fileName);
|
||||
stopWatch.Stop();
|
||||
_logger.Debug("Downloading Completed. took {0:0}s", stopWatch.Elapsed.Seconds);
|
||||
|
||||
Reference in New Issue
Block a user