mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
This commit is contained in:
@@ -1727,11 +1727,16 @@ namespace Jackett.Common.Indexers
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task<WebResult> HandleRedirectableRequestAsync(string url, Dictionary<string, string> headers = null)
|
protected async Task<WebResult> HandleRedirectableRequestAsync(string url, Dictionary<string, string> headers = null, int maxRedirects = 5)
|
||||||
{
|
{
|
||||||
var response = await RequestWithCookiesAsync(url, headers: headers);
|
var response = await RequestWithCookiesAsync(url, headers: headers);
|
||||||
if (response.IsRedirect)
|
for (var i = 0; i < maxRedirects; i++)
|
||||||
response = await RequestWithCookiesAsync(response.RedirectingTo, headers: headers);
|
{
|
||||||
|
if (response.IsRedirect)
|
||||||
|
response = await RequestWithCookiesAsync(response.RedirectingTo, headers: headers);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user