From e6c55283d235aa9404395d30f2db891f36995c49 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 9 Jul 2020 16:38:49 +0200 Subject: Keep URIs encoded in the acquire system We do not deal a lot with URIs which need encoding, but then we do it is a pain that we store it decoded in the acquire system as it means we have to decode and reencode URIs eventually which is potentially giving us slightly different URIs. We see that in our own testing framework while setting up redirects as the config options are effectively double-encoded and decoded to pass them around successfully as otherwise %2f and / in an URI are treated the same. This commit adds the infrastructure for methods to opt into getting URIs send in encoded form (and returning them to us in encoded form, too) so that we eventually do not have to touch the URIs which is how it should be. This means though that we have to deal with methods who do not support this yet (aka: all at the moment) for which we decode and encode while communicating with them. --- apt-pkg/acquire.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apt-pkg/acquire.h') diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 8cb4d2532..a2c4fbc67 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -363,6 +363,8 @@ class APT_PUBLIC pkgAcquire */ virtual ~pkgAcquire(); + APT_HIDDEN static std::string URIEncode(std::string const &part); + private: APT_HIDDEN void Initialize(); }; @@ -680,6 +682,8 @@ struct APT_PUBLIC pkgAcquire::MethodConfig APT_HIDDEN bool GetAuxRequests() const; APT_HIDDEN void SetAuxRequests(bool const value); + APT_HIDDEN bool GetSendURIEncoded() const; + APT_HIDDEN void SetSendURIEncoded(bool const value); virtual ~MethodConfig(); }; -- cgit v1.2.3