diff options
| author | Stefan Boberg <[email protected]> | 2025-10-24 19:32:01 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2025-10-24 19:32:01 +0200 |
| commit | 4cba4eb3f122c7a1a49b629b1c0656d7f817f001 (patch) | |
| tree | e184821073167f6e81a75193efca91013d7b359b /thirdparty/cpr/test/httpServer.hpp | |
| parent | fixed progress bar when scanning changed local files (#608) (diff) | |
| download | zen-4cba4eb3f122c7a1a49b629b1c0656d7f817f001.tar.xz zen-4cba4eb3f122c7a1a49b629b1c0656d7f817f001.zip | |
move cpr in-tree (#605)
* added cpr 1.10.5 in-tree to allow updates to vcpkg without breaking the build
* added asio 1.29.0 in-tree to remove one more vcpkg dependency
* bumped vcpkg to 2024.06.15 to address failure to build due to use of deprecated binaries in vcpkg (404 error: `https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~2.1.0-1-any.pkg.tar.zst` during build)
Diffstat (limited to 'thirdparty/cpr/test/httpServer.hpp')
| -rw-r--r-- | thirdparty/cpr/test/httpServer.hpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/thirdparty/cpr/test/httpServer.hpp b/thirdparty/cpr/test/httpServer.hpp new file mode 100644 index 000000000..735ff4097 --- /dev/null +++ b/thirdparty/cpr/test/httpServer.hpp @@ -0,0 +1,66 @@ +#ifndef CPR_TEST_HTTP_SERVER_H +#define CPR_TEST_HTTP_SERVER_H + +#include <memory> +#include <string> + +#include "abstractServer.hpp" +#include "cpr/cpr.h" +#include "mongoose.h" + +namespace cpr { +class HttpServer : public AbstractServer { + public: + ~HttpServer() override = default; + + std::string GetBaseUrl() override; + uint16_t GetPort() override; + + void OnRequest(mg_connection* conn, mg_http_message* msg) override; + + private: + static void OnRequestHello(mg_connection* conn, mg_http_message* msg); + static void OnRequestRoot(mg_connection* conn, mg_http_message* msg); + static void OnRequestOptions(mg_connection* conn, mg_http_message* msg); + static void OnRequestNotFound(mg_connection* conn, mg_http_message* msg); + static void OnRequestTimeout(mg_connection* conn, mg_http_message* msg); + static void OnRequestLongTimeout(mg_connection* conn, mg_http_message* msg); + static void OnRequestLowSpeedTimeout(mg_connection* conn, mg_http_message* msg, TimerArg* arg); + static void OnRequestLowSpeed(mg_connection* conn, mg_http_message* msg, mg_mgr* mgr); + static void OnRequestLowSpeedBytes(mg_connection* conn, mg_http_message* msg, TimerArg* arg); + static void OnRequestBasicCookies(mg_connection* conn, mg_http_message* msg); + static void OnRequestEmptyCookies(mg_connection* conn, mg_http_message* msg); + static void OnRequestCookiesReflect(mg_connection* conn, mg_http_message* msg); + static void OnRequestRedirectionWithChangingCookies(mg_connection* conn, mg_http_message* msg); + static void OnRequestBasicAuth(mg_connection* conn, mg_http_message* msg); + static void OnRequestBearerAuth(mg_connection* conn, mg_http_message* msg); + static void OnRequestBasicJson(mg_connection* conn, mg_http_message* msg); + static void OnRequestHeaderReflect(mg_connection* conn, mg_http_message* msg); + static void OnRequestTempRedirect(mg_connection* conn, mg_http_message* msg); + static void OnRequestPermRedirect(mg_connection* conn, mg_http_message* msg); + static void OnRequestResolvePermRedirect(mg_connection* conn, mg_http_message* msg); + static void OnRequestTwoRedirects(mg_connection* conn, mg_http_message* msg); + static void OnRequestUrlPost(mg_connection* conn, mg_http_message* msg); + static void OnRequestPostReflect(mg_connection* conn, mg_http_message* msg); + static void OnRequestBodyGet(mg_connection* conn, mg_http_message* msg); + static void OnRequestJsonPost(mg_connection* conn, mg_http_message* msg); + static void OnRequestFormPost(mg_connection* conn, mg_http_message* msg); + static void OnRequestDelete(mg_connection* conn, mg_http_message* msg); + static void OnRequestDeleteNotAllowed(mg_connection* conn, mg_http_message* msg); + static void OnRequestPut(mg_connection* conn, mg_http_message* msg); + static void OnRequestPutNotAllowed(mg_connection* conn, mg_http_message* msg); + static void OnRequestPatch(mg_connection* conn, mg_http_message* msg); + static void OnRequestPatchNotAllowed(mg_connection* conn, mg_http_message* msg); + static void OnRequestDownloadGzip(mg_connection* conn, mg_http_message* msg); + static void OnRequestLocalPort(mg_connection* conn, mg_http_message* msg); + static void OnRequestCheckAcceptEncoding(mg_connection* conn, mg_http_message* msg); + static void OnRequestCheckExpect100Continue(mg_connection* conn, mg_http_message* msg); + static void OnRequestGetDownloadFileLength(mg_connection* conn, mg_http_message* msg); + + protected: + mg_connection* initServer(mg_mgr* mgr, mg_event_handler_t event_handler) override; + void acceptConnection(mg_connection* conn) override; +}; +} // namespace cpr + +#endif |