detach PIHTTPServer::Endpoint to base struct PIHTTP::ServerEndpoint (private header), no functionality changes in HTTP server

Ready to implement this private base struct to MQTT client
This commit is contained in:
2026-05-26 21:31:58 +03:00
parent a2e54c3694
commit a2093e24a6
4 changed files with 76 additions and 300 deletions
+1 -35
View File
@@ -102,43 +102,9 @@ public:
void clearReplyHeaders() { reply_headers.clear(); }
private:
struct PathElement {
enum class Type {
Invalid = 0x01,
Fixed = 0x02,
Arguments = 0x04,
AnyOne = 0x08,
AnyPart = 0x10,
AnyMany = 0x20
};
Type type = Type::Fixed;
PIString source;
PIStringList parts;
PIMap<int, PIString> arguments;
PathElement(const PIString & reg = {});
bool match(const PIString & in, PIMap<PIString, PIString> & ext_args) const;
uint priority() const;
};
struct Endpoint {
PIStringList path;
PIHTTP::Method method = PIHTTP::Method::Unknown;
RequestFunction function;
PIFlags<PathElement::Type> path_types;
PIVector<PathElement> prepared_path;
uint priority = 0;
bool create(const PIString & p);
bool match(const PIStringList & in_path, PIMap<PIString, PIString> & ext_args) const;
};
static PIStringList splitPath(const PIString & path);
PRIVATE_DECLARATION(PIP_HTTP_SERVER_EXPORT)
PIMap<PIString, PIString> reply_headers;
PIMap<uint, PIVector<Endpoint>> endpoints;
RequestFunction unhandled;
};