Accumulate headers properly
This commit is contained in:
@@ -41,8 +41,14 @@ struct HttpConnectionState {
|
||||
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
|
||||
uint64_t request_id = 0; // X-Request-Id header value
|
||||
|
||||
// Header accumulation buffers (arena-allocated)
|
||||
using ArenaString =
|
||||
std::basic_string<char, std::char_traits<char>, ArenaStlAllocator<char>>;
|
||||
ArenaString current_header_field_buf;
|
||||
ArenaString current_header_value_buf;
|
||||
bool header_field_complete = false;
|
||||
uint64_t request_id = 0; // X-Request-Id header value
|
||||
|
||||
explicit HttpConnectionState(ArenaAllocator &arena);
|
||||
};
|
||||
@@ -67,7 +73,9 @@ public:
|
||||
// llhttp callbacks (public for HttpConnectionState access)
|
||||
static int onUrl(llhttp_t *parser, const char *at, size_t length);
|
||||
static int onHeaderField(llhttp_t *parser, const char *at, size_t length);
|
||||
static int onHeaderFieldComplete(llhttp_t *parser);
|
||||
static int onHeaderValue(llhttp_t *parser, const char *at, size_t length);
|
||||
static int onHeaderValueComplete(llhttp_t *parser);
|
||||
static int onHeadersComplete(llhttp_t *parser);
|
||||
static int onBody(llhttp_t *parser, const char *at, size_t length);
|
||||
static int onMessageComplete(llhttp_t *parser);
|
||||
|
||||
Reference in New Issue
Block a user