summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-07-08 17:51:40 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2020-12-18 19:02:05 +0100
commit97be873d782c5e9aaa8b4f4f4e6e18805d0fa51c (patch)
treee04d92ccbba4e17b1e6b8655df0de8defed98bcb /cmdline
parentece7f5bb0afee0994a4fb4380e756ce725fe67a9 (diff)
Proper URI encoding for config requests to our test webserver
Our http method encodes the URI again which results in the double encoding we have unwrap in the webserver (we did already, but we skip the filename handling now which does the first decode).
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-helper.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
index 3d6a692e0..85795e0d2 100644
--- a/cmdline/apt-helper.cc
+++ b/cmdline/apt-helper.cc
@@ -287,6 +287,14 @@ static bool AnalyzePattern(CommandLine &CmdL) /*{{{*/
return true;
}
/*}}}*/
+static bool DoQuoteString(CommandLine &CmdL) /*{{{*/
+{
+ if (CmdL.FileSize() != 3)
+ return _error->Error("Expect two arguments, a string to quote and a string of additional characters to quote");
+ std::cout << QuoteString(CmdL.FileList[1], CmdL.FileList[2]) << '\n';
+ return true;
+}
+ /*}}}*/
static bool ShowHelp(CommandLine &) /*{{{*/
{
std::cout <<
@@ -310,6 +318,7 @@ static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
{"drop-privs", &DropPrivsAndRun, _("drop privileges before running given command")},
{"analyze-pattern", &AnalyzePattern, _("analyse a pattern")},
{"analyse-pattern", &AnalyzePattern, nullptr},
+ {"quote-string", &DoQuoteString, nullptr},
{nullptr, nullptr, nullptr}};
}
/*}}}*/