handler: make client persistent

This commit is contained in:
Vaxry
2025-04-12 23:50:45 +01:00
parent 7e348baf8c
commit 2e48d32a4d
3 changed files with 24 additions and 8 deletions

View File

@@ -2,10 +2,18 @@
#include <pistache/http.h>
// Giga hack, but we need it cuz the API is quite awkward and incomplete
#define private public
#include <pistache/client.h>
#undef private
class CServerHandler : public Pistache::Http::Handler {
HTTP_PROTOTYPE(CServerHandler)
void init();
void finish();
void onRequest(const Pistache::Http::Request& req, Pistache::Http::ResponseWriter response);
void onTimeout(const Pistache::Http::Request& request, Pistache::Http::ResponseWriter response);
@@ -25,4 +33,6 @@ class CServerHandler : public Pistache::Http::Handler {
std::string token = "";
std::string error = "";
};
Pistache::Http::Experimental::Client* m_client = nullptr;
};