http server options, remove old

This commit is contained in:
2024-11-15 14:18:49 +03:00
parent cdde340efe
commit ee137b2820
5 changed files with 70 additions and 52 deletions

View File

@@ -27,6 +27,14 @@ public:
Trace,
Patch
};
enum class Option {
ConnectionLimit, // uint
ConnectionTimeout, // uint, sec
HTTPSEnabled, // bool
HTTPSMemKey, // const char * to key.pem data
HTTPSMemCert, // const char * to cert.pem data
HTTPSKeyPassword // const char * to passwd for key.pem
};
struct PIP_HTTP_SERVER_EXPORT Request {
MicrohttpdServer::Method method;
@@ -52,7 +60,7 @@ public:
PIMap<PIString, PIString> headers;
};
void setWWWRoot(const PIString & path);
void setOption(Option o, PIVariant v);
void setFavicon(const PIByteArray & im);
bool listen(PINetworkAddress addr);
@@ -63,12 +71,12 @@ public:
void setRequestCallback(std::function<Reply(Request)> c) { callback = c; }
private:
PIByteArray getFile(PIString name);
PRIVATE_DECLARATION(PIP_HTTP_SERVER_EXPORT)
PIString www_root;
PIByteArray favicon;
PIMap<Option, PIVariant> opts;
std::function<Reply(Request)> callback;
PIByteArray mem_key, mem_cert, key_pass;
};