#ifndef PIHTTPSERVER_H #define PIHTTPSERVER_H #include "microhttpd_server_p.h" #include "pip_http_server_export.h" class PIP_HTTP_SERVER_EXPORT PIHTTPServer: public MicrohttpdServer { PIOBJECT_SUBCLASS(PIHTTPServer, MicrohttpdServer) public: PIHTTPServer(); virtual ~PIHTTPServer(); using RequestFunction = std::function; void registerPath(const PIString & path, RequestFunction functor); void addReplyHeader(const PIString & name, const PIString & value) { reply_headers[name] = value; } void removeReplyHeader(const PIString & name) { reply_headers.remove(name); } void clearReplyHeaders() { reply_headers.clear(); } private: struct Endpoint { bool match(const PIStringList & in_path) const; PIStringList path; RequestFunction function; }; PIMap reply_headers; PIMap functions; }; #endif