add http_client library, using libcurl

take out common http entities to http_common dir
This commit is contained in:
2024-11-23 17:54:22 +03:00
parent bf9ad65ff0
commit dff4f2b3a0
17 changed files with 955 additions and 137 deletions

View File

@@ -10,11 +10,11 @@ public:
PIHTTPServer();
virtual ~PIHTTPServer();
using RequestFunction = std::function<MicrohttpdServer::Reply(const MicrohttpdServer::Request &)>;
using RequestFunction = std::function<PIHTTP::MessageMutable(const PIHTTP::MessageConst &)>;
void registerPath(const PIString & path, MicrohttpdServer::Method method, RequestFunction functor);
void registerPath(const PIString & path, PIHTTP::Method method, RequestFunction functor);
void registerUnhandled(RequestFunction functor);
void unregisterPath(const PIString & path, MicrohttpdServer::Method method);
void unregisterPath(const PIString & path, PIHTTP::Method method);
void unregisterPath(const PIString & path);
void addReplyHeader(const PIString & name, const PIString & value) { reply_headers[name] = value; }
@@ -25,7 +25,7 @@ private:
struct Endpoint {
bool match(const PIStringList & in_path) const;
PIStringList path;
MicrohttpdServer::Method method = MicrohttpdServer::Method::Unknown;
PIHTTP::Method method = PIHTTP::Method::Unknown;
RequestFunction function;
};
PIMap<PIString, PIString> reply_headers;