mirror of
https://github.com/Jackett/Jackett
synced 2025-03-10 14:14:25 +00:00
This commit is contained in:
parent
ea4d1f5f94
commit
3ba6081766
1 changed files with 8 additions and 3 deletions
|
@ -1727,11 +1727,16 @@ namespace Jackett.Common.Indexers
|
|||
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);
|
||||
if (response.IsRedirect)
|
||||
response = await RequestWithCookiesAsync(response.RedirectingTo, headers: headers);
|
||||
for (var i = 0; i < maxRedirects; i++)
|
||||
{
|
||||
if (response.IsRedirect)
|
||||
response = await RequestWithCookiesAsync(response.RedirectingTo, headers: headers);
|
||||
else
|
||||
break;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue