diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2013-10-16 22:43:01 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2013-11-30 12:38:26 +0100 |
commit | d23bda42456bd092751deb24d8295c27a15721e8 (patch) | |
tree | 30d5f334aa773cd54802a5a00e6003250102950c /test/interactive-helper/aptwebserver.cc | |
parent | 3c16b5fe7950e32a0a13ad7544ed531ace535316 (diff) |
webserver: strip parameters from filename
Again, not (currently) used by the tests itself, but in interactive
usage of the webserver itself.
Git-Dch: Ignore
Diffstat (limited to 'test/interactive-helper/aptwebserver.cc')
-rw-r--r-- | test/interactive-helper/aptwebserver.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index 0e04826c5..94f63bb39 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -308,7 +308,7 @@ void sendDirectoryListing(int const client, std::string const &dir, /*{{{*/ } /*}}}*/ bool parseFirstLine(int const client, std::string const &request, /*{{{*/ - std::string &filename, bool &sendContent, + std::string &filename, std::string ¶ms, bool &sendContent, bool &closeConnection) { if (strncmp(request.c_str(), "HEAD ", 5) == 0) @@ -375,6 +375,14 @@ bool parseFirstLine(int const client, std::string const &request, /*{{{*/ sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that"); return false; } + + size_t paramspos = filename.find('?'); + if (paramspos != std::string::npos) + { + params = filename.substr(paramspos + 1); + filename.erase(paramspos); + } + filename = DeQuoteString(filename); // this is not a secure server, but at least prevent the obvious … |