mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
HTTPWebClient: improve mono relative redirect bug workaround
This commit is contained in:
@@ -261,6 +261,9 @@ namespace Jackett.Common.Utils.Clients
|
||||
// URL decoding apparently is needed to, without it e.g. Demonoid download is broken
|
||||
// TODO: is it always needed (not just for relative redirects)?
|
||||
var newRedirectingTo = WebUtilityHelpers.UrlDecode(result.RedirectingTo, webRequest.Encoding);
|
||||
if (newRedirectingTo.StartsWith("file:////")) // Location without protocol but with host (only add scheme)
|
||||
newRedirectingTo = newRedirectingTo.Replace("file://", request.RequestUri.Scheme + ":");
|
||||
else
|
||||
newRedirectingTo = newRedirectingTo.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;
|
||||
|
@@ -281,6 +281,9 @@ namespace Jackett.Common.Utils.Clients
|
||||
// URL decoding apparently is needed to, without it e.g. Demonoid download is broken
|
||||
// TODO: is it always needed (not just for relative redirects)?
|
||||
var newRedirectingTo = WebUtilityHelpers.UrlDecode(result.RedirectingTo, webRequest.Encoding);
|
||||
if (newRedirectingTo.StartsWith("file:////")) // Location without protocol but with host (only add scheme)
|
||||
newRedirectingTo = newRedirectingTo.Replace("file://", request.RequestUri.Scheme + ":");
|
||||
else
|
||||
newRedirectingTo = newRedirectingTo.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;
|
||||
|
@@ -258,6 +258,9 @@ namespace Jackett.Common.Utils.Clients
|
||||
// URL decoding apparently is needed to, without it e.g. Demonoid download is broken
|
||||
// TODO: is it always needed (not just for relative redirects)?
|
||||
var newRedirectingTo = WebUtilityHelpers.UrlDecode(result.RedirectingTo, webRequest.Encoding);
|
||||
if (newRedirectingTo.StartsWith("file:////")) // Location without protocol but with host (only add scheme)
|
||||
newRedirectingTo = newRedirectingTo.Replace("file://", request.RequestUri.Scheme + ":");
|
||||
else
|
||||
newRedirectingTo = newRedirectingTo.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;
|
||||
|
Reference in New Issue
Block a user