From 96f8c55fe70eb7c0524f17cdc21022f65224e91f Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 22 Jun 2025 18:43:32 +1200 Subject: [PATCH] config: Update 2 files --- tests/ipdemo/src/drogon_stubs.hpp | 45 +++++++++++++++++++++++++++++++ tests/ipdemo/src/http_utils.hpp | 5 ++++ 2 files changed, 50 insertions(+) create mode 100644 tests/ipdemo/src/drogon_stubs.hpp diff --git a/tests/ipdemo/src/drogon_stubs.hpp b/tests/ipdemo/src/drogon_stubs.hpp new file mode 100644 index 0000000..1414fba --- /dev/null +++ b/tests/ipdemo/src/drogon_stubs.hpp @@ -0,0 +1,45 @@ +#pragma once + +#ifdef DROGON_HEADERS_MISSING + +#include +#include + +// Stub declarations for Drogon when headers aren't available +namespace drogon { + enum class Get { Get }; + enum class ReqResult { Ok }; + + class HttpRequest { + public: + static HttpRequest* newHttpRequest(); + void setMethod(Get method); + void setPath(const std::string& path); + }; + + class HttpResponse { + public: + int statusCode() const; + std::string body() const; + }; + using HttpResponsePtr = std::shared_ptr; + + class HttpClient { + public: + static HttpClient* newHttpClient(const std::string& url, void* loop); + static HttpClient* newHttpClient(const std::string& url, void* loop, bool useOldTls, bool validateCert); + void setCertPath(const std::string& cert, const std::string& key); + void addSSLConfigs(const std::vector>& configs); + void sendRequest(HttpRequest* req, std::function callback, double timeout); + }; +} + +namespace trantor { + class EventLoop { + public: + void loop(); + void quit(); + }; +} + +#endif \ No newline at end of file diff --git a/tests/ipdemo/src/http_utils.hpp b/tests/ipdemo/src/http_utils.hpp index 53b9f43..787a5a9 100644 --- a/tests/ipdemo/src/http_utils.hpp +++ b/tests/ipdemo/src/http_utils.hpp @@ -4,8 +4,13 @@ #include #include #include + +#ifdef DROGON_HEADERS_MISSING +#include "drogon_stubs.hpp" +#else #include #include +#endif struct HttpResponse { int status_code;