Package: apt-cacher-ng Followup-For: Bug #1074404 X-Debbugs-Cc: tj.iam...@proton.me
As soon as I re-read the proposed patch I realised it is wrong in two ways: 1. it would be triggered by // protocol specificier 2. there is already a later stanza to deal with path-only However the existing path-only is pre-empted by the // protocol detection. This revised patch moves the existing path detection before // protocol but ensures the second character is not also '/'.
>From dcedac77092b08c358cb9017767c70025f92aee4 Mon Sep 17 00:00:00 2001 From: Tj <hac...@iam.tj> Date: Wed, 26 Jun 2024 01:39:16 +0100 Subject: [PATCH] Location: handle /path/ redirects Fixes 302 Location redirects on snapshot.debian.org. Signed-off-by: Tj <hac...@iam.tj> --- src/dlcon.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dlcon.cc b/src/dlcon.cc index 935e41f..978118e 100644 --- a/src/dlcon.cc +++ b/src/dlcon.cc @@ -209,6 +209,11 @@ struct tDlJob auto sLocationDecoded = UrlUnescape(pNewUrl); + if (startsWithSz(sLocationDecoded, "/") && sLocationDecoded[1] != '/') + { + m_remoteUri.sPath = sLocationDecoded; + return true; + } tHttpUrl newUri; if (newUri.SetHttpUrl(sLocationDecoded, false)) { @@ -237,11 +242,6 @@ struct tDlJob m_remoteUri.sPath += sPathBackup; } - if (startsWithSz(sLocationDecoded, "/")) - { - m_remoteUri.sPath = sLocationDecoded; - return true; - } // ok, must be relative m_remoteUri.sPath += (sPathSepUnix + sLocationDecoded); return true; -- 2.39.2