diff --git a/deps/libhttpserver/basic_auth_fail_response.hpp.patch b/deps/libhttpserver/basic_auth_fail_response.hpp.patch deleted file mode 100644 index 9d0cb75246..0000000000 --- a/deps/libhttpserver/basic_auth_fail_response.hpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/httpserver/basic_auth_fail_response.hpp b/src/httpserver/basic_auth_fail_response.hpp -index c7e2d47..c6eeb60 100644 ---- a/src/httpserver/basic_auth_fail_response.hpp -+++ b/src/httpserver/basic_auth_fail_response.hpp -@@ -47,7 +47,7 @@ class basic_auth_fail_response : public string_response - } - - basic_auth_fail_response(const basic_auth_fail_response& other) = default; -- basic_auth_fail_response(basic_auth_fail_response&& other) noexcept = default; -+ basic_auth_fail_response(basic_auth_fail_response&& other) = default; - basic_auth_fail_response& operator=(const basic_auth_fail_response& b) = default; - basic_auth_fail_response& operator=(basic_auth_fail_response&& b) = default; - diff --git a/deps/libhttpserver/create_webserver.hpp.patch b/deps/libhttpserver/create_webserver.hpp.patch deleted file mode 100644 index 1d98d2ec84..0000000000 --- a/deps/libhttpserver/create_webserver.hpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/httpserver/create_webserver.hpp b/src/httpserver/create_webserver.hpp -index 678a161..cb14ac9 100644 ---- a/src/httpserver/create_webserver.hpp -+++ b/src/httpserver/create_webserver.hpp -@@ -48,7 +48,7 @@ class create_webserver - public: - create_webserver() = default; - create_webserver(const create_webserver& b) = default; -- create_webserver(create_webserver&& b) noexcept = default; -+ create_webserver(create_webserver&& b) = default; - create_webserver& operator=(const create_webserver& b) = default; - create_webserver& operator=(create_webserver&& b) = default; - diff --git a/deps/libhttpserver/deferred_response.hpp.patch b/deps/libhttpserver/deferred_response.hpp.patch deleted file mode 100644 index 48816e15c9..0000000000 --- a/deps/libhttpserver/deferred_response.hpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/httpserver/deferred_response.hpp b/src/httpserver/deferred_response.hpp -index 170d5e8..9431986 100644 ---- a/src/httpserver/deferred_response.hpp -+++ b/src/httpserver/deferred_response.hpp -@@ -55,7 +55,7 @@ class deferred_response : public string_response - } - - deferred_response(const deferred_response& other) = default; -- deferred_response(deferred_response&& other) noexcept = default; -+ deferred_response(deferred_response&& other) = default; - deferred_response& operator=(const deferred_response& b) = default; - deferred_response& operator=(deferred_response&& b) = default; - diff --git a/deps/libhttpserver/digest_auth_fail_response.hpp.patch b/deps/libhttpserver/digest_auth_fail_response.hpp.patch deleted file mode 100644 index 85689e6824..0000000000 --- a/deps/libhttpserver/digest_auth_fail_response.hpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/httpserver/digest_auth_fail_response.hpp b/src/httpserver/digest_auth_fail_response.hpp -index 292f477..dfcccc9 100644 ---- a/src/httpserver/digest_auth_fail_response.hpp -+++ b/src/httpserver/digest_auth_fail_response.hpp -@@ -51,7 +51,7 @@ class digest_auth_fail_response : public string_response - } - - digest_auth_fail_response(const digest_auth_fail_response& other) = default; -- digest_auth_fail_response(digest_auth_fail_response&& other) noexcept = default; -+ digest_auth_fail_response(digest_auth_fail_response&& other) = default; - digest_auth_fail_response& operator=(const digest_auth_fail_response& b) = default; - digest_auth_fail_response& operator=(digest_auth_fail_response&& b) = default; - diff --git a/deps/libhttpserver/empty_uri_log_crash.patch b/deps/libhttpserver/empty_uri_log_crash.patch index 9b788eadb2..5027a64dc0 100644 --- a/deps/libhttpserver/empty_uri_log_crash.patch +++ b/deps/libhttpserver/empty_uri_log_crash.patch @@ -1,19 +1,12 @@ -commit 2678fcf0bc7a645a4043f5c194dfc75da35ab072 -Author: Miro Stauder -Date: Tue Jan 24 15:05:11 2023 +0000 - - webserver.patch - -diff --git a/src/webserver.cpp b/src/webserver.cpp -index 38542f2..0ae69dc 100644 ---- a/src/webserver.cpp -+++ b/src/webserver.cpp -@@ -441,7 +441,7 @@ MHD_Result policy_callback (void *cls, const struct sockaddr* addr, socklen_t ad - void* uri_log(void* cls, const char* uri) - { - struct details::modded_request* mr = new details::modded_request(); -- mr->complete_uri = new string(uri); -+ mr->complete_uri = new string(uri == NULL ? "" : uri); - mr->second = false; - return ((void*)mr); +diff -upr libhttpserver.clean/src/webserver.cpp libhttpserver/src/webserver.cpp +--- libhttpserver.clean/src/webserver.cpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/webserver.cpp 2023-10-17 10:11:18.350231611 +0000 +@@ -420,7 +420,7 @@ void* uri_log(void* cls, const char* uri + std::ignore = con; + + auto mr = std::make_unique(); +- mr->complete_uri = std::make_unique(uri); ++ mr->complete_uri = std::make_unique(uri == NULL ? "" : uri); + return reinterpret_cast(mr.release()); } + \ No newline at end of file diff --git a/deps/libhttpserver/file_response.hpp.patch b/deps/libhttpserver/file_response.hpp.patch deleted file mode 100644 index e95a689fad..0000000000 --- a/deps/libhttpserver/file_response.hpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/httpserver/file_response.hpp b/src/httpserver/file_response.hpp -index cb80c11..d08f8d4 100644 ---- a/src/httpserver/file_response.hpp -+++ b/src/httpserver/file_response.hpp -@@ -46,7 +46,7 @@ class file_response : public http_response - } - - file_response(const file_response& other) = default; -- file_response(file_response&& other) noexcept = default; -+ file_response(file_response&& other) = default; - - file_response& operator=(const file_response& b) = default; - file_response& operator=(file_response&& b) = default; diff --git a/deps/libhttpserver/final_val_post_process.patch b/deps/libhttpserver/final_val_post_process.patch index 834c41b3a4..84c36ebba9 100644 --- a/deps/libhttpserver/final_val_post_process.patch +++ b/deps/libhttpserver/final_val_post_process.patch @@ -1,17 +1,10 @@ -commit 3dab3a696e61c341029ad459608f2626e6e5547f -Author: Miro Stauder -Date: Mon Jan 9 12:06:29 2023 +0000 - - final_val_post_process.patch - -diff --git a/src/webserver.cpp b/src/webserver.cpp -index 38542f2..e6ef554 100644 ---- a/src/webserver.cpp -+++ b/src/webserver.cpp -@@ -674,6 +674,14 @@ MHD_Result webserver::finalize_answer( - { - if(hrm->is_allowed(method)) - { +diff -upr libhttpserver.clean/src/webserver.cpp libhttpserver/src/webserver.cpp +--- libhttpserver.clean/src/webserver.cpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/webserver.cpp 2023-10-17 10:03:00.696612945 +0000 +@@ -676,6 +676,14 @@ MHD_Result webserver::finalize_answer(MH + if (found) { + try { + if (hrm->is_allowed(method)) { + // NOTE: Here 'MHD_destroy_post_processor' is required for performing a final 'post_process' + // of the 'URL Encode'. This ensures ensures the processing of final key without value left + // at the end of the buffer. See function internal doc at 'postprocessor.c'. @@ -20,6 +13,6 @@ index 38542f2..e6ef554 100644 + mr->pp = NULL; + } + - mr->dhrs = ((hrm)->*(mr->callback))(*mr->dhr); //copy in memory (move in case) - if (mr->dhrs->get_response_code() == -1) - { + mr->dhrs = ((hrm)->*(mr->callback))(*mr->dhr); // copy in memory (move in case) + if (mr->dhrs.get() == nullptr || mr->dhrs->get_response_code() == -1) { + mr->dhrs = internal_error_page(mr); diff --git a/deps/libhttpserver/http_request.hpp.patch b/deps/libhttpserver/http_request.hpp.patch deleted file mode 100644 index 57e740b280..0000000000 --- a/deps/libhttpserver/http_request.hpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/httpserver/http_request.hpp b/src/httpserver/http_request.hpp -index 139272b..3c8213b 100644 ---- a/src/httpserver/http_request.hpp -+++ b/src/httpserver/http_request.hpp -@@ -231,7 +231,7 @@ class http_request - * @param b http_request b to copy attributes from. - **/ - http_request(const http_request& b) = default; -- http_request(http_request&& b) noexcept = default; -+ http_request(http_request&& b) = default; - - http_request& operator=(const http_request& b) = default; - http_request& operator=(http_request&& b) = default; diff --git a/deps/libhttpserver/http_resource.hpp.patch b/deps/libhttpserver/http_resource.hpp.patch deleted file mode 100644 index 1e1f320f91..0000000000 --- a/deps/libhttpserver/http_resource.hpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/httpserver/http_resource.hpp b/src/httpserver/http_resource.hpp -index 7841b96..fd6e6ea 100644 ---- a/src/httpserver/http_resource.hpp -+++ b/src/httpserver/http_resource.hpp -@@ -217,7 +217,7 @@ class http_resource - * Copy constructor - **/ - http_resource(const http_resource& b) = default; -- http_resource(http_resource&& b) noexcept = default; -+ http_resource(http_resource&& b) = default; - http_resource& operator=(const http_resource& b) = default; - http_resource& operator=(http_resource&& b) = default; - diff --git a/deps/libhttpserver/http_response.hpp.patch b/deps/libhttpserver/http_response.hpp.patch deleted file mode 100644 index 967134e827..0000000000 --- a/deps/libhttpserver/http_response.hpp.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/src/httpserver/http_response.hpp b/src/httpserver/http_response.hpp -index 33c1df4..7533cd9 100644 ---- a/src/httpserver/http_response.hpp -+++ b/src/httpserver/http_response.hpp -@@ -59,10 +59,10 @@ class http_response - * @param b The http_response object to copy attributes value from. - **/ - http_response(const http_response& b) = default; -- http_response(http_response&& b) noexcept = default; -+ http_response(http_response&& b) = default; - - http_response& operator=(const http_response& b) = default; -- http_response& operator=(http_response&& b) noexcept = default; -+ http_response& operator=(http_response&& b) = default; - - virtual ~http_response() = default; - diff --git a/deps/libhttpserver/libhttpserver b/deps/libhttpserver/libhttpserver index 04da4a00dc..6980195184 120000 --- a/deps/libhttpserver/libhttpserver +++ b/deps/libhttpserver/libhttpserver @@ -1 +1 @@ -libhttpserver-0.18.2 \ No newline at end of file +libhttpserver-0.19.0 \ No newline at end of file diff --git a/deps/libhttpserver/libhttpserver-0.18.2.tar.gz b/deps/libhttpserver/libhttpserver-0.18.2.tar.gz deleted file mode 100644 index c5edd61f0d..0000000000 Binary files a/deps/libhttpserver/libhttpserver-0.18.2.tar.gz and /dev/null differ diff --git a/deps/libhttpserver/libhttpserver-0.19.0.tar.gz b/deps/libhttpserver/libhttpserver-0.19.0.tar.gz new file mode 100644 index 0000000000..9f52c495e8 Binary files /dev/null and b/deps/libhttpserver/libhttpserver-0.19.0.tar.gz differ diff --git a/deps/libhttpserver/noexcept.patch b/deps/libhttpserver/noexcept.patch index 91bffffbdd..ebec92c526 100644 --- a/deps/libhttpserver/noexcept.patch +++ b/deps/libhttpserver/noexcept.patch @@ -1,127 +1,112 @@ -commit 28afed88f70420ee256e627d065d21a00d9d7977 -Author: Miro Stauder -Date: Mon Jan 9 12:05:26 2023 +0000 +diff -upr libhttpserver.clean/src/httpserver/basic_auth_fail_response.hpp libhttpserver/src/httpserver/basic_auth_fail_response.hpp +--- libhttpserver.clean/src/httpserver/basic_auth_fail_response.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/basic_auth_fail_response.hpp 2023-10-17 09:20:20.022117928 +0000 +@@ -47,7 +47,7 @@ class basic_auth_fail_response : public + realm(realm) { } + + basic_auth_fail_response(const basic_auth_fail_response& other) = default; +- basic_auth_fail_response(basic_auth_fail_response&& other) noexcept = default; ++ basic_auth_fail_response(basic_auth_fail_response&& other) = default; + basic_auth_fail_response& operator=(const basic_auth_fail_response& b) = default; + basic_auth_fail_response& operator=(basic_auth_fail_response&& b) = default; + +diff -upr libhttpserver.clean/src/httpserver/create_webserver.hpp libhttpserver/src/httpserver/create_webserver.hpp +--- libhttpserver.clean/src/httpserver/create_webserver.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/create_webserver.hpp 2023-10-17 09:20:20.024117944 +0000 +@@ -51,7 +51,7 @@ class create_webserver { + public: + create_webserver() = default; + create_webserver(const create_webserver& b) = default; +- create_webserver(create_webserver&& b) noexcept = default; ++ create_webserver(create_webserver&& b) = default; + create_webserver& operator=(const create_webserver& b) = default; + create_webserver& operator=(create_webserver&& b) = default; + +diff -upr libhttpserver.clean/src/httpserver/deferred_response.hpp libhttpserver/src/httpserver/deferred_response.hpp +--- libhttpserver.clean/src/httpserver/deferred_response.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/deferred_response.hpp 2023-10-17 09:20:20.024117944 +0000 +@@ -55,7 +55,7 @@ class deferred_response : public string_ + closure_data(closure_data) { } + + deferred_response(const deferred_response& other) = default; +- deferred_response(deferred_response&& other) noexcept = default; ++ deferred_response(deferred_response&& other) = default; + deferred_response& operator=(const deferred_response& b) = default; + deferred_response& operator=(deferred_response&& b) = default; - noexcept.patch - -diff --git a/src/httpserver/basic_auth_fail_response.hpp b/src/httpserver/basic_auth_fail_response.hpp -index a28fa3d..24bb132 100644 ---- a/src/httpserver/basic_auth_fail_response.hpp -+++ b/src/httpserver/basic_auth_fail_response.hpp -@@ -52,7 +52,7 @@ class basic_auth_fail_response : public string_response - } - - basic_auth_fail_response(const basic_auth_fail_response& other) = default; -- basic_auth_fail_response(basic_auth_fail_response&& other) noexcept = default; -+ basic_auth_fail_response(basic_auth_fail_response&& other) = default; - basic_auth_fail_response& operator=(const basic_auth_fail_response& b) = default; - basic_auth_fail_response& operator=(basic_auth_fail_response&& b) = default; - -diff --git a/src/httpserver/create_webserver.hpp b/src/httpserver/create_webserver.hpp -index 39cb3ec..f43c8f5 100644 ---- a/src/httpserver/create_webserver.hpp -+++ b/src/httpserver/create_webserver.hpp -@@ -48,7 +48,7 @@ class create_webserver - public: - create_webserver() = default; - create_webserver(const create_webserver& b) = default; -- create_webserver(create_webserver&& b) noexcept = default; -+ create_webserver(create_webserver&& b) = default; - create_webserver& operator=(const create_webserver& b) = default; - create_webserver& operator=(create_webserver&& b) = default; - -diff --git a/src/httpserver/deferred_response.hpp b/src/httpserver/deferred_response.hpp -index 9e4601e..a8ba748 100644 ---- a/src/httpserver/deferred_response.hpp -+++ b/src/httpserver/deferred_response.hpp -@@ -61,7 +61,7 @@ class deferred_response : public string_response - } - - deferred_response(const deferred_response& other) = default; -- deferred_response(deferred_response&& other) noexcept = default; -+ deferred_response(deferred_response&& other) = default; - deferred_response& operator=(const deferred_response& b) = default; - deferred_response& operator=(deferred_response&& b) = default; - -diff --git a/src/httpserver/digest_auth_fail_response.hpp b/src/httpserver/digest_auth_fail_response.hpp -index 50abcee..18cf19c 100644 ---- a/src/httpserver/digest_auth_fail_response.hpp -+++ b/src/httpserver/digest_auth_fail_response.hpp -@@ -56,7 +56,7 @@ class digest_auth_fail_response : public string_response - } - - digest_auth_fail_response(const digest_auth_fail_response& other) = default; -- digest_auth_fail_response(digest_auth_fail_response&& other) noexcept = default; -+ digest_auth_fail_response(digest_auth_fail_response&& other) = default; - digest_auth_fail_response& operator=(const digest_auth_fail_response& b) = default; - digest_auth_fail_response& operator=(digest_auth_fail_response&& b) = default; - -diff --git a/src/httpserver/file_response.hpp b/src/httpserver/file_response.hpp -index 0c9386f..2e10f6c 100644 ---- a/src/httpserver/file_response.hpp -+++ b/src/httpserver/file_response.hpp -@@ -50,7 +50,7 @@ class file_response : public http_response - } - - file_response(const file_response& other) = default; -- file_response(file_response&& other) noexcept = default; -+ file_response(file_response&& other) = default; - - file_response& operator=(const file_response& b) = default; - file_response& operator=(file_response&& b) = default; -diff --git a/src/httpserver/http_request.hpp b/src/httpserver/http_request.hpp -index 6aacbfe..0b83fa2 100644 ---- a/src/httpserver/http_request.hpp -+++ b/src/httpserver/http_request.hpp -@@ -227,7 +227,7 @@ class http_request - * @param b http_request b to copy attributes from. - **/ - http_request(const http_request& b) = default; -- http_request(http_request&& b) noexcept = default; -+ http_request(http_request&& b) = default; - - http_request& operator=(const http_request& b) = default; - http_request& operator=(http_request&& b) = default; -diff --git a/src/httpserver/http_resource.hpp b/src/httpserver/http_resource.hpp -index 04f67cb..59829e8 100644 ---- a/src/httpserver/http_resource.hpp -+++ b/src/httpserver/http_resource.hpp -@@ -211,7 +211,7 @@ class http_resource - * Copy constructor - **/ - http_resource(const http_resource& b) = default; -- http_resource(http_resource&& b) noexcept = default; -+ http_resource(http_resource&& b) = default; - http_resource& operator=(const http_resource& b) = default; - http_resource& operator=(http_resource&& b) = default; - -diff --git a/src/httpserver/http_response.hpp b/src/httpserver/http_response.hpp -index 1f3f097..3564f37 100644 ---- a/src/httpserver/http_response.hpp -+++ b/src/httpserver/http_response.hpp -@@ -55,10 +55,10 @@ class http_response - * @param b The http_response object to copy attributes value from. - **/ - http_response(const http_response& b) = default; -- http_response(http_response&& b) noexcept = default; -+ http_response(http_response&& b) = default; - - http_response& operator=(const http_response& b) = default; -- http_response& operator=(http_response&& b) noexcept = default; -+ http_response& operator=(http_response&& b) = default; - - virtual ~http_response() = default; - -diff --git a/src/httpserver/string_response.hpp b/src/httpserver/string_response.hpp -index 43e7580..2043890 100644 ---- a/src/httpserver/string_response.hpp -+++ b/src/httpserver/string_response.hpp -@@ -51,7 +51,7 @@ class string_response : public http_response - } - - string_response(const string_response& other) = default; -- string_response(string_response&& other) noexcept = default; -+ string_response(string_response&& other) = default; - - string_response& operator=(const string_response& b) = default; - string_response& operator=(string_response&& b) = default; +diff -upr libhttpserver.clean/src/httpserver/digest_auth_fail_response.hpp libhttpserver/src/httpserver/digest_auth_fail_response.hpp +--- libhttpserver.clean/src/httpserver/digest_auth_fail_response.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/digest_auth_fail_response.hpp 2023-10-17 09:20:20.024117944 +0000 +@@ -50,7 +50,7 @@ class digest_auth_fail_response : public + reload_nonce(reload_nonce) { } + + digest_auth_fail_response(const digest_auth_fail_response& other) = default; +- digest_auth_fail_response(digest_auth_fail_response&& other) noexcept = default; ++ digest_auth_fail_response(digest_auth_fail_response&& other) = default; + digest_auth_fail_response& operator=(const digest_auth_fail_response& b) = default; + digest_auth_fail_response& operator=(digest_auth_fail_response&& b) = default; + +diff -upr libhttpserver.clean/src/httpserver/file_response.hpp libhttpserver/src/httpserver/file_response.hpp +--- libhttpserver.clean/src/httpserver/file_response.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/file_response.hpp 2023-10-17 09:20:20.024117944 +0000 +@@ -58,7 +58,7 @@ class file_response : public http_respon + filename(filename) { } + + file_response(const file_response& other) = default; +- file_response(file_response&& other) noexcept = default; ++ file_response(file_response&& other) = default; + + file_response& operator=(const file_response& b) = default; + file_response& operator=(file_response&& b) = default; +diff -upr libhttpserver.clean/src/httpserver/http_request.hpp libhttpserver/src/httpserver/http_request.hpp +--- libhttpserver.clean/src/httpserver/http_request.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/http_request.hpp 2023-10-17 09:20:20.024117944 +0000 +@@ -277,7 +277,7 @@ class http_request { + * Move constructor. + * @param b http_request b to move attributes from. + **/ +- http_request(http_request&& b) noexcept = default; ++ http_request(http_request&& b) = default; + + /** + * Copy-assign. Deleted to make class move-only. The class is move-only for several reasons: +diff -upr libhttpserver.clean/src/httpserver/http_resource.hpp libhttpserver/src/httpserver/http_resource.hpp +--- libhttpserver.clean/src/httpserver/http_resource.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/http_resource.hpp 2023-10-17 09:20:20.024117944 +0000 +@@ -222,7 +222,7 @@ class http_resource { + * Copy constructor + **/ + http_resource(const http_resource& b) = default; +- http_resource(http_resource&& b) noexcept = default; ++ http_resource(http_resource&& b) = default; + http_resource& operator=(const http_resource& b) = default; + http_resource& operator=(http_resource&& b) = default; + +diff -upr libhttpserver.clean/src/httpserver/http_response.hpp libhttpserver/src/httpserver/http_response.hpp +--- libhttpserver.clean/src/httpserver/http_response.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/http_response.hpp 2023-10-17 09:20:20.024117944 +0000 +@@ -53,10 +53,10 @@ class http_response { + * @param b The http_response object to copy attributes value from. + **/ + http_response(const http_response& b) = default; +- http_response(http_response&& b) noexcept = default; ++ http_response(http_response&& b) = default; + + http_response& operator=(const http_response& b) = default; +- http_response& operator=(http_response&& b) noexcept = default; ++ http_response& operator=(http_response&& b) = default; + + virtual ~http_response() = default; + +diff -upr libhttpserver.clean/src/httpserver/string_response.hpp libhttpserver/src/httpserver/string_response.hpp +--- libhttpserver.clean/src/httpserver/string_response.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/string_response.hpp 2023-10-17 09:20:20.024117944 +0000 +@@ -46,7 +46,7 @@ class string_response : public http_resp + content(std::move(content)) { } + + string_response(const string_response& other) = default; +- string_response(string_response&& other) noexcept = default; ++ string_response(string_response&& other) = default; + + string_response& operator=(const string_response& b) = default; + string_response& operator=(string_response&& b) = default; diff --git a/deps/libhttpserver/re2_regex.patch b/deps/libhttpserver/re2_regex.patch index 83e833bedb..09405899f8 100644 --- a/deps/libhttpserver/re2_regex.patch +++ b/deps/libhttpserver/re2_regex.patch @@ -1,13 +1,6 @@ -commit ff6527c6b71fd1d33c39b8dca2a89170de5c2263 -Author: Miro Stauder -Date: Mon Jan 9 12:05:55 2023 +0000 - - re2_regex.patch - -diff --git a/examples/Makefile.am b/examples/Makefile.am -index 318a7a8..0da1879 100644 ---- a/examples/Makefile.am -+++ b/examples/Makefile.am +diff -upr libhttpserver.clean/examples/Makefile.am libhttpserver/examples/Makefile.am +--- libhttpserver.clean/examples/Makefile.am 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/examples/Makefile.am 2023-10-17 09:20:20.024117944 +0000 @@ -16,8 +16,12 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -21,51 +14,25 @@ index 318a7a8..0da1879 100644 +LDADD = $(top_builddir)/src/libhttpserver.la -L$(RE2_PATH)/obj -lre2 +AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/httpserver/ -I$(RE2_IDIR) METASOURCES = AUTO - noinst_PROGRAMS = hello_world service minimal_hello_world custom_error allowing_disallowing_methods handlers hello_with_get_arg setting_headers custom_access_log basic_authentication digest_authentication minimal_https minimal_file_response minimal_deferred url_registration minimal_ip_ban benchmark_select benchmark_threads benchmark_nodelay deferred_with_accumulator + noinst_PROGRAMS = hello_world service minimal_hello_world custom_error allowing_disallowing_methods handlers hello_with_get_arg setting_headers custom_access_log basic_authentication digest_authentication minimal_https minimal_file_response minimal_deferred url_registration minimal_ip_ban benchmark_select benchmark_threads benchmark_nodelay deferred_with_accumulator file_upload -diff --git a/src/Makefile.am b/src/Makefile.am -index 5e549bb..1fcc59e 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -16,7 +16,11 @@ - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - --AM_CPPFLAGS = -I../ -I$(srcdir)/httpserver/ -+DEPS_PATH=$(top_srcdir)/../../ -+RE2_PATH=$(DEPS_PATH)/re2/re2 -+RE2_IDIR=$(RE2_PATH) -+ -+AM_CPPFLAGS = -I../ -I$(srcdir)/httpserver/ -I$(RE2_IDIR) - METASOURCES = AUTO - lib_LTLIBRARIES = libhttpserver.la - libhttpserver_la_SOURCES = string_utilities.cpp webserver.cpp http_utils.cpp http_request.cpp http_response.cpp string_response.cpp basic_auth_fail_response.cpp digest_auth_fail_response.cpp deferred_response.cpp file_response.cpp http_resource.cpp details/http_endpoint.cpp -@@ -37,7 +41,7 @@ endif - - libhttpserver_la_CFLAGS = $(AM_CFLAGS) - libhttpserver_la_CXXFLAGS = $(AM_CXXFLAGS) --libhttpserver_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -+libhttpserver_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -L$(RE2_PATH)/obj -lre2 +diff -upr libhttpserver.clean/src/details/http_endpoint.cpp libhttpserver/src/details/http_endpoint.cpp +--- libhttpserver.clean/src/details/http_endpoint.cpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/details/http_endpoint.cpp 2023-10-17 09:36:36.625373755 +0000 +@@ -43,6 +43,7 @@ http_endpoint::~http_endpoint() { + } - install-data-hook: - (mkdir -p $(DESTDIR)$(includedir) && cd $(DESTDIR)$(includedir) && $(LN_S) -f httpserver.hpp httpserverpp) -diff --git a/src/details/http_endpoint.cpp b/src/details/http_endpoint.cpp -index 584fb50..01292d5 100644 ---- a/src/details/http_endpoint.cpp -+++ b/src/details/http_endpoint.cpp -@@ -52,6 +52,7 @@ http_endpoint::http_endpoint - bool registration, - bool use_regex - ): + http_endpoint::http_endpoint(const string& url, bool family, bool registration, bool use_regex): + re_url_normalized(new re2::RE2("")), family_url(family), - reg_compiled(false) - { -@@ -130,9 +131,19 @@ http_endpoint::http_endpoint + reg_compiled(false) { + if (use_regex && !registration) { +@@ -110,8 +111,18 @@ http_endpoint::http_endpoint(const strin + if (use_regex) { url_normalized += "$"; - try - { + try { - re_url_normalized = std::regex(url_normalized, std::regex::extended | std::regex::icase | std::regex::nosubs); +- } catch (std::regex_error& e) { + re2::RE2::Options opts {}; + opts.set_case_sensitive(true); + opts.set_never_capture(true); @@ -77,22 +44,20 @@ index 584fb50..01292d5 100644 + if (re_url_normalized->ok() != true) { + throw std::invalid_argument("Invalid regex supplied to re2"); + } - } -- catch (std::regex_error& e) -+ catch (std::invalid_argument& e) - { ++ } catch (std::invalid_argument& e) { throw std::invalid_argument("Not a valid regex in URL: " + url_normalized); } -@@ -146,7 +157,7 @@ http_endpoint::http_endpoint(const http_endpoint& h): + reg_compiled = true; +@@ -124,7 +135,7 @@ http_endpoint::http_endpoint(const http_ url_pars(h.url_pars), url_pieces(h.url_pieces), chunk_positions(h.chunk_positions), - re_url_normalized(h.re_url_normalized), + re_url_normalized(new re2::RE2(h.re_url_normalized->pattern())), family_url(h.family_url), - reg_compiled(h.reg_compiled) - { -@@ -158,7 +169,7 @@ http_endpoint& http_endpoint::operator =(const http_endpoint& h) + reg_compiled(h.reg_compiled) { + } +@@ -134,7 +145,7 @@ http_endpoint& http_endpoint::operator = url_normalized = h.url_normalized; family_url = h.family_url; reg_compiled = h.reg_compiled; @@ -101,16 +66,16 @@ index 584fb50..01292d5 100644 url_pars = h.url_pars; url_pieces = h.url_pieces; chunk_positions = h.chunk_positions; -@@ -176,7 +187,7 @@ bool http_endpoint::match(const http_endpoint& url) const +@@ -150,7 +161,7 @@ bool http_endpoint::match(const http_end + if (!reg_compiled) throw std::invalid_argument("Cannot run match. Regex suppressed."); - if(!family_url || url.url_pieces.size() < url_pieces.size()) - { + if (!family_url || url.url_pieces.size() < url_pieces.size()) { - return regex_match(url.url_complete, re_url_normalized); + return RE2::FullMatch(url.url_complete, *re_url_normalized); } string nn = "/"; -@@ -186,7 +197,7 @@ bool http_endpoint::match(const http_endpoint& url) const +@@ -159,7 +170,7 @@ bool http_endpoint::match(const http_end nn += (first ? "" : "/") + url.url_pieces[i]; first = false; } @@ -118,16 +83,16 @@ index 584fb50..01292d5 100644 + return RE2::FullMatch(nn, *re_url_normalized); } - }; -diff --git a/src/httpserver/details/http_endpoint.hpp b/src/httpserver/details/http_endpoint.hpp -index 37fd0d8..ae92782 100644 ---- a/src/httpserver/details/http_endpoint.hpp -+++ b/src/httpserver/details/http_endpoint.hpp -@@ -25,11 +25,12 @@ - #ifndef _HTTP_ENDPOINT_HPP_ - #define _HTTP_ENDPOINT_HPP_ + } // namespace details + +diff -upr libhttpserver.clean/src/httpserver/details/http_endpoint.hpp libhttpserver/src/httpserver/details/http_endpoint.hpp +--- libhttpserver.clean/src/httpserver/details/http_endpoint.hpp 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/httpserver/details/http_endpoint.hpp 2023-10-17 09:40:50.077082067 +0000 +@@ -27,11 +27,12 @@ --#include + // cpplint errors on regex because it is replaced (in Chromium) by re2 google library. + // We don't have that alternative here (and we are actively avoiding dependencies). +-#include // NOLINT [build/c++11] +#include "re2/re2.h" #include #include @@ -135,23 +100,48 @@ index 37fd0d8..ae92782 100644 #include +#include - namespace httpserver - { -@@ -136,7 +137,7 @@ class http_endpoint - http_endpoint(): - url_complete("/"), - url_normalized("/"), -- re_url_normalized(std::regex("")), // initialize empty -+ re_url_normalized(new re2::RE2("")), // initialize empty - family_url(false), - reg_compiled(false) - { -@@ -187,7 +188,7 @@ class http_endpoint - /** - * Regex used in comparisons - **/ -- std::regex re_url_normalized; -+ std::unique_ptr re_url_normalized; + namespace httpserver { + +@@ -128,7 +129,7 @@ class http_endpoint { + http_endpoint(): + url_complete("/"), + url_normalized("/"), +- re_url_normalized(std::regex("")), // initialize empty ++ re_url_normalized(new re2::RE2("")), // initialize empty + family_url(false), + reg_compiled(false) { } + +@@ -177,7 +178,7 @@ class http_endpoint { + /** + * Regex used in comparisons + **/ +- std::regex re_url_normalized; ++ std::unique_ptr re_url_normalized; + + /** + * Boolean indicating wheter the endpoint represents a family +diff -upr libhttpserver.clean/src/Makefile.am libhttpserver/src/Makefile.am +--- libhttpserver.clean/src/Makefile.am 2023-06-16 03:49:56.000000000 +0000 ++++ libhttpserver/src/Makefile.am 2023-10-17 09:20:20.024117944 +0000 +@@ -16,7 +16,11 @@ + # License along with this library; if not, write to the Free Software + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +-AM_CPPFLAGS = -I../ -I$(srcdir)/httpserver/ ++DEPS_PATH=$(top_srcdir)/../../ ++RE2_PATH=$(DEPS_PATH)/re2/re2 ++RE2_IDIR=$(RE2_PATH) ++ ++AM_CPPFLAGS = -I../ -I$(srcdir)/httpserver/ -I$(RE2_IDIR) + METASOURCES = AUTO + lib_LTLIBRARIES = libhttpserver.la + libhttpserver_la_SOURCES = string_utilities.cpp webserver.cpp http_utils.cpp file_info.cpp http_request.cpp http_response.cpp string_response.cpp basic_auth_fail_response.cpp digest_auth_fail_response.cpp deferred_response.cpp file_response.cpp http_resource.cpp details/http_endpoint.cpp +@@ -37,7 +41,7 @@ endif + + libhttpserver_la_CFLAGS = $(AM_CFLAGS) + libhttpserver_la_CXXFLAGS = $(AM_CXXFLAGS) +-libhttpserver_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined ++libhttpserver_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -L$(RE2_PATH)/obj -lre2 - /** - * Boolean indicating wheter the endpoint represents a family + install-data-hook: + (mkdir -p $(DESTDIR)$(includedir) && cd $(DESTDIR)$(includedir) && $(LN_S) -f httpserver.hpp httpserverpp) diff --git a/deps/libhttpserver/string_response.hpp.patch b/deps/libhttpserver/string_response.hpp.patch deleted file mode 100644 index 37a01eb057..0000000000 --- a/deps/libhttpserver/string_response.hpp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/httpserver/string_response.hpp b/src/httpserver/string_response.hpp -index 87f12c6..ee864a7 100644 ---- a/src/httpserver/string_response.hpp -+++ b/src/httpserver/string_response.hpp -@@ -46,7 +46,7 @@ class string_response : public http_response - } - - string_response(const string_response& other) = default; -- string_response(string_response&& other) noexcept = default; -+ string_response(string_response&& other) = default; - - string_response& operator=(const string_response& b) = default; - string_response& operator=(string_response&& b) = default; diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index a420b3e1e5..37a69ea462 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -6529,7 +6529,7 @@ std::map request_headers(const httpserver::http_request& request) std::map result {}; for (const auto& header : req_headers) { - result.insert({header.first, header.second}); + result.insert({(string) header.first, (string) header.second}); } return result; diff --git a/lib/ProxySQL_RESTAPI_Server.cpp b/lib/ProxySQL_RESTAPI_Server.cpp index 795112b9c4..e5f3c967b2 100644 --- a/lib/ProxySQL_RESTAPI_Server.cpp +++ b/lib/ProxySQL_RESTAPI_Server.cpp @@ -32,7 +32,7 @@ class sync_resource : public http_resource { const string req_path { req.get_path() }; const string select_query { "SELECT * FROM runtime_restapi_routes WHERE uri='" + req_uri + "' and" - " method='" + req.get_method() + "' and active=1" + " method='" + (string) req.get_method() + "' and active=1" }; std::unique_ptr resultset { @@ -41,10 +41,10 @@ class sync_resource : public http_resource { if (!resultset) { proxy_error( - "Cannot query script for given method [%s] and uri [%s]\n", req.get_method().c_str(), req_uri.c_str() + "Cannot query script for given method [%s] and uri [%s]\n", ((string) req.get_method()).c_str(), req_uri.c_str() ); const string not_found_err_msg { - "The script for method [" + req.get_method() + "] and route [" + req.get_path() + "] was not found." + "The script for method [" + (string) req.get_method() + "] and route [" + (string) req.get_path() + "] was not found." }; json j_err_resp {}; @@ -63,13 +63,13 @@ class sync_resource : public http_resource { return response; } else if (resultset && resultset->rows_count != 1) { const string not_found_err_msg { - "The script for method [" + req.get_method() + "] and route [" + req_path + "] was not found." + "The script for method [" + (string) req.get_method() + "] and route [" + (string) req_path + "] was not found." " Rows count returned [" + std::to_string(resultset->rows_count) + "]" }; json j_err_resp { { "error", not_found_err_msg } }; proxy_error( - "Script for method [%s] and uri [%s] was not found\n", req.get_method().c_str(), req_uri.c_str() + "Script for method [%s] and uri [%s] was not found\n", ((string) req.get_method()).c_str(), ((string) req_uri).c_str() ); auto response = std::shared_ptr(new string_response(j_err_resp.dump(), http::http_utils::http_bad_request)); @@ -85,7 +85,7 @@ class sync_resource : public http_resource { } const std::shared_ptr process_request(const http_request& req, const std::string& _params) { - std::string params = req.get_content(); + std::string params = (string) req.get_content(); const string req_path { req.get_path() }; if (params.empty()) @@ -271,9 +271,9 @@ class sync_resource : public http_resource { } public: - const std::shared_ptr render(const http_request& req) { - proxy_info("Render generic request with method %s for uri %s\n", req.get_method().c_str(), req.get_path().c_str()); - json j_err_resp {{ "error", "HTTP method " + req.get_method() + " is not implemented" }}; + std::shared_ptr render(const http_request& req) { + proxy_info("Render generic request with method %s for uri %s\n", ((string) req.get_method()).c_str(), ((string) req.get_path()).c_str()); + json j_err_resp {{ "error", "HTTP method " + (string) req.get_method() + " is not implemented" }}; auto response = std::shared_ptr(new string_response(j_err_resp.dump())); response->with_header("Content-Type", "application/json"); response->with_header("Access-Control-Allow-Origin", "*"); @@ -281,7 +281,7 @@ class sync_resource : public http_resource { return response; } - const std::shared_ptr render_GET(const http_request& req) { + std::shared_ptr render_GET(const http_request& req) { const auto args = req.get_args(); // Explicit object creation, otherwise 'array' is initialized @@ -293,7 +293,7 @@ class sync_resource : public http_resource { const string s_params { input_params.dump() }; #ifdef DEBUG - const char* req_path { req.get_path().c_str() }; + const char* req_path { ((string) req.get_path()).c_str() }; const char* p_params { s_params.c_str() }; proxy_debug(PROXY_DEBUG_RESTAPI, 1, "Processing GET - req: '%s', params: `%s`\n", req_path, p_params); #endif @@ -301,11 +301,11 @@ class sync_resource : public http_resource { return process_request(req, s_params); } - const std::shared_ptr render_POST(const http_request& req) { - std::string params=req.get_content(); + std::shared_ptr render_POST(const http_request& req) { + std::string params = (std::string) req.get_content(); #ifdef DEBUG - const char* req_path { req.get_path().c_str() }; + const char* req_path { ((string) req.get_path()).c_str() }; const char* p_params { params.c_str() }; proxy_debug(PROXY_DEBUG_RESTAPI, 1, "Processing POST - req: '%s', params: `%s`\n", req_path, p_params); #endif @@ -323,7 +323,7 @@ class gen_get_endpoint : public http_resource { _get_fn(get_fn) {} - const std::shared_ptr render_GET(const http_request& req) override { + std::shared_ptr render_GET(const http_request& req) override { return this->_get_fn(req); } };