Add unix socket listening mode
This commit is contained in:
@@ -19,6 +19,7 @@ enum class HttpRoute {
|
||||
GET_retention,
|
||||
DELETE_retention,
|
||||
GET_metrics,
|
||||
GET_ok,
|
||||
NotFound
|
||||
};
|
||||
|
||||
@@ -38,7 +39,9 @@ struct HttpConnectionState {
|
||||
// Parse state
|
||||
bool headers_complete = false;
|
||||
bool message_complete = false;
|
||||
bool connection_close = false; // Client requested connection close
|
||||
HttpRoute route = HttpRoute::NotFound;
|
||||
std::string_view current_header_field; // Current header being parsed
|
||||
|
||||
explicit HttpConnectionState(ArenaAllocator &arena);
|
||||
};
|
||||
@@ -79,14 +82,17 @@ private:
|
||||
void handleDeleteRetention(Connection &conn,
|
||||
const HttpConnectionState &state);
|
||||
void handleGetMetrics(Connection &conn, const HttpConnectionState &state);
|
||||
void handleGetOk(Connection &conn, const HttpConnectionState &state);
|
||||
void handleNotFound(Connection &conn, const HttpConnectionState &state);
|
||||
|
||||
// HTTP utilities
|
||||
static void sendResponse(Connection &conn, int status_code,
|
||||
std::string_view content_type,
|
||||
std::string_view body);
|
||||
std::string_view content_type, std::string_view body,
|
||||
bool close_connection = false);
|
||||
static void sendJsonResponse(Connection &conn, int status_code,
|
||||
std::string_view json);
|
||||
std::string_view json,
|
||||
bool close_connection = false);
|
||||
static void sendErrorResponse(Connection &conn, int status_code,
|
||||
std::string_view message);
|
||||
std::string_view message,
|
||||
bool close_connection = false);
|
||||
};
|
||||
Reference in New Issue
Block a user