mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
add workaround for mono relative redirect bug
This commit is contained in:
@@ -196,6 +196,15 @@ namespace Jackett.Utils.Clients
|
|||||||
{
|
{
|
||||||
result.RedirectingTo = response.Headers.Location.ToString();
|
result.RedirectingTo = response.Headers.Location.ToString();
|
||||||
}
|
}
|
||||||
|
// Mono won't add the baseurl to relative redirects.
|
||||||
|
// e.g. a "Location: /index.php" header will result in the Uri "file:///index.php"
|
||||||
|
// See issue #1200
|
||||||
|
if (result.RedirectingTo != null && result.RedirectingTo.StartsWith("file://"))
|
||||||
|
{
|
||||||
|
var newRedirectingTo = result.RedirectingTo.Replace("file://", request.RequestUri.Scheme + "://" + request.RequestUri.Host);
|
||||||
|
logger.Debug("[MONO relative redirect bug] Rewriting relative redirect URL from " + result.RedirectingTo + " to " + newRedirectingTo);
|
||||||
|
result.RedirectingTo = newRedirectingTo;
|
||||||
|
}
|
||||||
result.Status = response.StatusCode;
|
result.Status = response.StatusCode;
|
||||||
|
|
||||||
// Compatiblity issue between the cookie format and httpclient
|
// Compatiblity issue between the cookie format and httpclient
|
||||||
|
@@ -207,6 +207,15 @@ namespace Jackett.Utils.Clients
|
|||||||
{
|
{
|
||||||
result.RedirectingTo = response.Headers.Location.ToString();
|
result.RedirectingTo = response.Headers.Location.ToString();
|
||||||
}
|
}
|
||||||
|
// Mono won't add the baseurl to relative redirects.
|
||||||
|
// e.g. a "Location: /index.php" header will result in the Uri "file:///index.php"
|
||||||
|
// See issue #1200
|
||||||
|
if (result.RedirectingTo != null && result.RedirectingTo.StartsWith("file://"))
|
||||||
|
{
|
||||||
|
var newRedirectingTo = result.RedirectingTo.Replace("file://", request.RequestUri.Scheme + "://" + request.RequestUri.Host);
|
||||||
|
logger.Debug("[MONO relative redirect bug] Rewriting relative redirect URL from " + result.RedirectingTo + " to " + newRedirectingTo);
|
||||||
|
result.RedirectingTo = newRedirectingTo;
|
||||||
|
}
|
||||||
result.Status = response.StatusCode;
|
result.Status = response.StatusCode;
|
||||||
|
|
||||||
// Compatiblity issue between the cookie format and httpclient
|
// Compatiblity issue between the cookie format and httpclient
|
||||||
|
Reference in New Issue
Block a user