libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit b20bf0c0035e5e23f180696ac82cd83f9120ea81
parent efdaa50c6c681358c22594bac28a5b1b87967b03
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date:   Mon, 23 Nov 2026 18:46:52 +0100

get_req_header(): header name processing optimisation

To be forward-ported together with other related optimisations

Diffstat:
Msrc/microhttpd/connection.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c @@ -6476,7 +6476,15 @@ get_req_header (struct MHD_Connection *c, ERR_RSP_INVALID_CHAR_IN_FIELD_NAME); return MHD_HDR_LINE_READING_DATA_ERROR; } - +#ifndef MHD_FAVOR_SMALL_CODE + /* A tight loop for processing header (field) names */ + while (c->read_buffer_offset > ++p) + { + if (! char_legal_in_field_name (c->read_buffer[p])) + break; /* Re-process the current character in the standard loop */ + } + continue; +#endif /* ! MHD_FAVOR_SMALL_CODE */ } else {