diff options
Diffstat (limited to 'weblog.cpp')
-rw-r--r-- | weblog.cpp | 49 |
1 files changed, 8 insertions, 41 deletions
@@ -2,6 +2,7 @@ #include "libreichwein/mime.h" #include "libreichwein/stringhelper.h" +#include "libreichwein/url.h" #include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/replace.hpp> @@ -322,36 +323,6 @@ namespace { } } - 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> SplitQueryString(std::string& s) { std::unordered_map<std::string, std::string> result; @@ -362,7 +333,7 @@ namespace { for (auto i: list) { size_t apos = i.find('='); if (apos != i.npos) { - result[urlDecode(i.substr(0, apos))] = urlDecode(i.substr(apos + 1)); + result[Reichwein::URL::urlDecode(i.substr(0, apos))] = Reichwein::URL::urlDecode(i.substr(apos + 1)); } } } @@ -374,22 +345,17 @@ namespace { } // anonymous namespace -std::string weblog_plugin::name() -{ - return "weblog"; -} - -weblog_plugin::weblog_plugin() +Weblog::Weblog() { //std::cout << "Plugin constructor" << std::endl; } -weblog_plugin::~weblog_plugin() +Weblog::~Weblog() { //std::cout << "Plugin destructor" << std::endl; } -std::string weblog_plugin::generate_page( +std::string Weblog::generate_page( std::function<std::string(const std::string& key)>& GetServerParam, std::function<std::string(const std::string& key)>& GetRequestParam, // request including body (POST...) std::function<void(const std::string& key, const std::string& value)>& SetResponseHeader // to be added to result string @@ -450,7 +416,8 @@ std::string weblog_plugin::generate_page( } } -bool weblog_plugin::has_own_authentication() +void Weblog::run(int argc, char* argv[]) { - return false; + return 0; } + |