summaryrefslogtreecommitdiff
path: root/methods/aptmethod.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-07-10 00:02:25 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2020-12-18 19:31:19 +0100
commit97d6c3b2d05fe0d965657197adf56cc78f9edf81 (patch)
tree3c5b7c22635ffcde0b174e60660c01168e33ff71 /methods/aptmethod.h
parente6c55283d235aa9404395d30f2db891f36995c49 (diff)
Implement encoded URI handling in all methods
Every method opts in to getting the encoded URI passed along while keeping compat in case we are operated by an older acquire system. Effectively this is just a change for the http-based methods as the others just decode the URI as they work with files directly.
Diffstat (limited to 'methods/aptmethod.h')
-rw-r--r--methods/aptmethod.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/methods/aptmethod.h b/methods/aptmethod.h
index 67d5a3a0b..7038131cf 100644
--- a/methods/aptmethod.h
+++ b/methods/aptmethod.h
@@ -475,6 +475,18 @@ protected:
QueueBack = Queue;
delete Tmp;
}
+ static std::string URIEncode(std::string const &part)
+ {
+ // The "+" is encoded as a workaround for an S3 bug (LP#1003633 and LP#1086997)
+ return QuoteString(part, _config->Find("Acquire::URIEncode", "+~ ").c_str());
+ }
+
+ static std::string DecodeSendURI(std::string const &part)
+ {
+ if (_config->FindB("Acquire::Send-URI-Encoded", false))
+ return DeQuoteString(part);
+ return part;
+ }
aptMethod(std::string &&Binary, char const *const Ver, unsigned long const Flags) APT_NONNULL(3)
: pkgAcqMethod(Ver, Flags), Binary(Binary), SeccompFlags(0), methodNames({Binary})