diff options
author | Roland Reichwein <mail@reichwein.it> | 2021-09-24 11:02:21 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2021-09-24 11:02:21 +0200 |
commit | 9a40db34cd48b776023e3558a855458fa4f9d264 (patch) | |
tree | b7458e4702fa01a73adc78c73563590cb8d684f3 /plugins/webbox | |
parent | 108dec000f813e1ba54dfc2a59a9dfe028cca414 (diff) |
webserver version 1.14: Bugfix: URL decode in static files
Diffstat (limited to 'plugins/webbox')
-rw-r--r-- | plugins/webbox/webbox.cpp | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/plugins/webbox/webbox.cpp b/plugins/webbox/webbox.cpp index 26d49c8..c8e4b38 100644 --- a/plugins/webbox/webbox.cpp +++ b/plugins/webbox/webbox.cpp @@ -4,6 +4,7 @@ #include "libcommon/tempfile.h" #include "libcommon/file.h" #include "libcommon/stringutil.h" +#include "libcommon/url.h" #include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/replace.hpp> @@ -45,36 +46,6 @@ namespace { { "500", "Internal Server Error" } }; - std::string urlDecode(std::string s) - { - std::string result; - - size_t pos = 0; - while (pos < s.size()) { - char c {s[pos]}; - if (c == '+') { - result += ' '; - } else if (c == '%' && pos + 2 < s.size()) { - try { - int i = stoi(s.substr(pos + 1, 2), 0, 16); - if (i < 0 || i > 255) - return result; - - result += static_cast<char>(i); - } catch (...) { - return result; - } - - pos += 2; - } else { - result += c; - } - pos++; - } - - return result; - } - std::unordered_map<std::string, std::string> ParseQueryString(const std::string& s, const std::string& webboxPath) { std::unordered_map<std::string, std::string> result; @@ -376,7 +347,7 @@ protected: virtual std::string start(CommandParameters& p) { p.m_SetResponseHeader("content_type", "text/plain"); - return p.m_GetServerParam("version") + "<br/>(C) 2020 <a href=\"https://www.reichwein.it/\">Reichwein.IT</a>"; + return p.m_GetServerParam("version") + "<br/>(C) 2021 <a href=\"https://www.reichwein.it/\">Reichwein.IT</a>"; } }; |