From 9d60b64fe684b18af5323c2b52cb26c04883db72 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 5 Jan 2023 14:03:38 +0100 Subject: Adjust to new API --- TODO | 1 + plugins/statistics/statistics.cpp | 12 ++++++------ plugins/webbox/webbox.cpp | 8 ++++---- plugins/weblog/weblog.cpp | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index 1131af1..b5106c3 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ Big file bug +Websockets stats.png cgi unhandled headers diff --git a/plugins/statistics/statistics.cpp b/plugins/statistics/statistics.cpp index 959fd33..8932527 100644 --- a/plugins/statistics/statistics.cpp +++ b/plugins/statistics/statistics.cpp @@ -38,14 +38,14 @@ namespace { std::string statistics{GetServerParam("statistics")}; Tempfile tempStats{".txt"}; // input data - File::setFile(tempStats.GetPath(), statistics); + File::setFile(tempStats.getPath(), statistics); Tempfile tempPng{".png"}; // output Tempfile tempGnuplot{".gnuplot"}; std::stringstream s; s << "set terminal png truecolor\n"; - s << "set output " << tempPng.GetPath() << "\n"; // quotes added automatically for paths + s << "set output " << tempPng.getPath() << "\n"; // quotes added automatically for paths s << "set title \"Webserver Throughput\"\n"; s << "set xlabel \"Time\"\n"; s << "set timefmt \"%s\"\n"; @@ -56,17 +56,17 @@ namespace { s << "set datafile separator \",\"\n"; s << "set grid\n"; s << "set style fill solid\n"; - s << "plot " << tempStats.GetPath() << " using 1:($4+$5) with boxes title \"Bytes I/O\" lt rgb \"#1132A7\"\n"; - File::setFile(tempGnuplot.GetPath(), s.str()); + s << "plot " << tempStats.getPath() << " using 1:($4+$5) with boxes title \"Bytes I/O\" lt rgb \"#1132A7\"\n"; + File::setFile(tempGnuplot.getPath(), s.str()); - int exit_code{system(("gnuplot "s + tempGnuplot.GetPath().generic_string()).c_str())}; + int exit_code{system(("gnuplot "s + tempGnuplot.getPath().generic_string()).c_str())}; if (exit_code) { std::cerr << "Error: gnuplot returned " << std::to_string(exit_code) << std::endl; return HttpStatus("500", "Statistics error"s, SetResponseHeader); } SetResponseHeader("content_type", "image/png"); - return File::getFile(tempPng.GetPath()); + return File::getFile(tempPng.getPath()); } // returns sum over specified column diff --git a/plugins/webbox/webbox.cpp b/plugins/webbox/webbox.cpp index df7e946..d838d93 100644 --- a/plugins/webbox/webbox.cpp +++ b/plugins/webbox/webbox.cpp @@ -3,7 +3,7 @@ #include "libreichwein/mime.h" #include "libreichwein/tempfile.h" #include "libreichwein/file.h" -#include "libreichwein/stringutil.h" +#include "libreichwein/stringhelper.h" #include "libreichwein/url.h" #include @@ -28,7 +28,7 @@ using namespace std::string_literals; namespace fs = std::filesystem; namespace pt = boost::property_tree; using namespace Reichwein::Mime; -using namespace Reichwein::Stringutil; +using namespace Reichwein::Stringhelper; using namespace Reichwein::URL; using namespace Reichwein; @@ -487,7 +487,7 @@ protected: Tempfile tempfile{".zip"}; // guards this path, removing file afterwards via RAII - arglist = "/usr/bin/zip -r - "s + arglist + " > "s + tempfile.GetPath().string(); + arglist = "/usr/bin/zip -r - "s + arglist + " > "s + tempfile.getPath().string(); int system_result {system(arglist.c_str())}; if (system_result != 0) { @@ -495,7 +495,7 @@ protected: } try { - std::string zipData{File::getFile(tempfile.GetPath())}; + std::string zipData{File::getFile(tempfile.getPath())}; p.m_SetResponseHeader("content_type", "application/octet-stream"); p.m_SetResponseHeader("content_disposition", "attachment; filename=\""s + DOWNLOAD_FILENAME + "\""); return zipData; diff --git a/plugins/weblog/weblog.cpp b/plugins/weblog/weblog.cpp index 1aea2f4..cc2be34 100644 --- a/plugins/weblog/weblog.cpp +++ b/plugins/weblog/weblog.cpp @@ -1,7 +1,7 @@ #include "weblog.h" #include "libreichwein/mime.h" -#include "libreichwein/stringutil.h" +#include "libreichwein/stringhelper.h" #include #include @@ -19,7 +19,7 @@ using namespace std::string_literals; namespace fs = std::filesystem; namespace pt = boost::property_tree; using namespace Reichwein::Mime; -using namespace Reichwein::Stringutil; +using namespace Reichwein::Stringhelper; namespace { -- cgit v1.2.3