From 92a14d375c8cd9dabc32ccb6dcbdf83321af535f Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 11 Feb 2023 16:04:35 +0100 Subject: Added config --- weblog.cpp | 49 ++++++++----------------------------------------- 1 file changed, 8 insertions(+), 41 deletions(-) (limited to 'weblog.cpp') diff --git a/weblog.cpp b/weblog.cpp index cc2be34..7842ac3 100644 --- a/weblog.cpp +++ b/weblog.cpp @@ -2,6 +2,7 @@ #include "libreichwein/mime.h" #include "libreichwein/stringhelper.h" +#include "libreichwein/url.h" #include #include @@ -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(i); - } catch (...) { - return result; - } - - pos += 2; - } else { - result += c; - } - pos++; - } - - return result; - } - std::unordered_map SplitQueryString(std::string& s) { std::unordered_map 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& GetServerParam, std::function& GetRequestParam, // request including body (POST...) std::function& 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; } + -- cgit v1.2.3