mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Suppress HTTP Errors on initial indexer call until after re-auth attempt
This commit is contained in:
@@ -889,7 +889,6 @@ namespace NzbDrone.Core.Indexers.Cardigann
|
||||
}
|
||||
|
||||
request.HttpRequest.Method = method;
|
||||
request.HttpRequest.SuppressHttpError = true;
|
||||
|
||||
yield return request;
|
||||
}
|
||||
|
@@ -390,6 +390,11 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
protected virtual bool CheckIfLoginNeeded(HttpResponse httpResponse)
|
||||
{
|
||||
if (httpResponse.StatusCode == HttpStatusCode.Unauthorized)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -425,6 +430,7 @@ namespace NzbDrone.Core.Indexers
|
||||
|
||||
var stopWatch = Stopwatch.StartNew();
|
||||
|
||||
request.HttpRequest.SuppressHttpError = true;
|
||||
var response = _httpClient.Execute(request.HttpRequest);
|
||||
|
||||
stopWatch.Stop();
|
||||
@@ -448,6 +454,21 @@ namespace NzbDrone.Core.Indexers
|
||||
response = _httpClient.Execute(request.HttpRequest);
|
||||
}
|
||||
|
||||
// Throw any other http error we get after attempting auth
|
||||
if (response.HasHttpError)
|
||||
{
|
||||
_logger.Warn("HTTP Error - {0}", response);
|
||||
|
||||
if ((int)response.StatusCode == 429)
|
||||
{
|
||||
throw new TooManyRequestsException(request.HttpRequest, response);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new HttpException(request.HttpRequest, response);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateCookies(Cookies, DateTime.Now + TimeSpan.FromDays(30));
|
||||
|
||||
return new IndexerResponse(request, response, stopWatch.ElapsedMilliseconds);
|
||||
|
Reference in New Issue
Block a user