mirror of https://github.com/Jackett/Jackett
indexers: fix redirects not returning the new responses
Fixes #15372 Fixes #15373
This commit is contained in:
parent
7204656e86
commit
de07e921ac
|
@ -529,7 +529,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
if (response.IsRedirect)
|
||||
{
|
||||
await FollowIfRedirect(response);
|
||||
response = await FollowIfRedirect(response);
|
||||
}
|
||||
|
||||
if (response.IsRedirect)
|
||||
|
@ -538,7 +538,7 @@ namespace Jackett.Common.Indexers
|
|||
if (redirectingTo.Scheme == "magnet")
|
||||
return Encoding.UTF8.GetBytes(redirectingTo.OriginalString);
|
||||
|
||||
await FollowIfRedirect(response);
|
||||
response = await FollowIfRedirect(response);
|
||||
}
|
||||
|
||||
if (response.Status != System.Net.HttpStatusCode.OK && response.Status != System.Net.HttpStatusCode.Continue && response.Status != System.Net.HttpStatusCode.PartialContent)
|
||||
|
@ -560,7 +560,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
var response = await RequestWithCookiesAsync(requestLink, null, RequestType.GET, referer);
|
||||
if (response.IsRedirect)
|
||||
await FollowIfRedirect(response);
|
||||
response = await FollowIfRedirect(response);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
if (response.IsRedirect)
|
||||
{
|
||||
await FollowIfRedirect(response, request.Url, redirectUrlOverride, response.Cookies, accumulateCookies);
|
||||
response = await FollowIfRedirect(response, request.Url, redirectUrlOverride, response.Cookies, accumulateCookies);
|
||||
}
|
||||
|
||||
if (returnCookiesFromFirstCall)
|
||||
|
@ -646,7 +646,7 @@ namespace Jackett.Common.Indexers
|
|||
}
|
||||
}
|
||||
|
||||
protected async Task FollowIfRedirect(WebResult response, string referrer = null, string overrideRedirectUrl = null, string overrideCookies = null, bool accumulateCookies = false, int maxRedirects = 5)
|
||||
protected async Task<WebResult> FollowIfRedirect(WebResult response, string referrer = null, string overrideRedirectUrl = null, string overrideCookies = null, bool accumulateCookies = false, int maxRedirects = 5)
|
||||
{
|
||||
for (var i = 0; i < maxRedirects; i++)
|
||||
{
|
||||
|
@ -674,6 +674,8 @@ namespace Jackett.Common.Indexers
|
|||
response.Cookies = overrideCookies;
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
protected virtual string ResolveCookies(string incomingCookies = "")
|
||||
|
|
|
@ -861,7 +861,7 @@ namespace Jackett.Common.Indexers
|
|||
// Follow the redirect on login if the domain doesn't change
|
||||
if (testResult.IsRedirect && GetRedirectDomainHint(testResult) == null)
|
||||
{
|
||||
await FollowIfRedirect(testResult, LoginTestUrl, overrideCookies: testResult.Cookies, accumulateCookies: true, maxRedirects: 1);
|
||||
testResult = await FollowIfRedirect(testResult, LoginTestUrl, overrideCookies: testResult.Cookies, accumulateCookies: true, maxRedirects: 1);
|
||||
}
|
||||
|
||||
if (testResult.IsRedirect)
|
||||
|
@ -977,7 +977,7 @@ namespace Jackett.Common.Indexers
|
|||
// Some sites have a temporary redirect before the login page, we need to process it.
|
||||
if (Definition.Followredirect)
|
||||
{
|
||||
await FollowIfRedirect(landingResult, LoginUrl.AbsoluteUri, overrideCookies: landingResult.Cookies, accumulateCookies: true);
|
||||
landingResult = await FollowIfRedirect(landingResult, LoginUrl.AbsoluteUri, overrideCookies: landingResult.Cookies, accumulateCookies: true);
|
||||
}
|
||||
|
||||
var hasCaptcha = false;
|
||||
|
@ -1532,7 +1532,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
if (response.IsRedirect && SearchPath.Followredirect)
|
||||
{
|
||||
await FollowIfRedirect(response);
|
||||
response = await FollowIfRedirect(response);
|
||||
}
|
||||
|
||||
var results = response.ContentString;
|
||||
|
@ -1559,7 +1559,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
if (response.IsRedirect && SearchPath.Followredirect)
|
||||
{
|
||||
await FollowIfRedirect(response);
|
||||
response = await FollowIfRedirect(response);
|
||||
}
|
||||
|
||||
results = response.ContentString;
|
||||
|
@ -1750,7 +1750,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
if (response.IsRedirect && SearchPath.Followredirect)
|
||||
{
|
||||
await FollowIfRedirect(response);
|
||||
response = await FollowIfRedirect(response);
|
||||
}
|
||||
|
||||
results = response.ContentString;
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace Jackett.Common.Indexers
|
|||
// Retrieve RSS feed
|
||||
var result = await RequestWithCookiesAndRetryAsync(RssFeedUri);
|
||||
if (result.IsRedirect)
|
||||
await FollowIfRedirect(result);
|
||||
result = await FollowIfRedirect(result);
|
||||
|
||||
// Parse as XML document
|
||||
var xmlDocument = new XmlDocument();
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
// Get result from redirect
|
||||
var loginCookies = result.Cookies;
|
||||
await FollowIfRedirect(result, LoginUrl, null, loginCookies);
|
||||
result = await FollowIfRedirect(result, LoginUrl, null, loginCookies);
|
||||
|
||||
await ConfigureIfOK(loginCookies, result.ContentString?.Contains("logout.php") == true, () =>
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue