]> git.kaiwu.me - haproxy.git/commit
REORG: h1: move chunk extensions parsing to a dedicated inline function
authorWilly Tarreau <w@1wt.eu>
Mon, 23 Nov 2026 22:23:17 +0000 (22:23 +0000)
committerWilly Tarreau <w@1wt.eu>
Tue, 24 Nov 2026 09:50:37 +0000 (10:50 +0100)
commit6d51bbc395ca606a4a49222bacee780155a78357
tree843b5be5a02326510af3b51d96ef1e6d3e1d08d5
parentda7eb7b3976287c9c6e9c1913bcb522553021409
REORG: h1: move chunk extensions parsing to a dedicated inline function

The chunk extensions parser of the contiguous chunks parser is moved as-is
to h1_parse_chunk_ext() in h1.h so that it can be shared with the generic
chunk-size parser instead of being duplicated and maintained twice. It
works on contiguous memory with the reverse index convention of the
contiguous parser (end[ridx], ridx < 0 reaching zero at the end of the
input) and returns the new index of the final CR, 0 if more data are
needed, or the opposite of the faulty char's index. It is force-inlined
since streams of tiny chunks each carrying an extension (e.g.
"1;1\r\n1\r\n") must not cost a function call per chunk.

Only the exits were adapted: on the CR, the function returns its index
after checking the pending BWS/equal/quote states, and the CRLF is now
checked by the caller. Running out of data returns 0, and errors return
the opposite of the faulty char's index.
include/haproxy/h1.h
src/h1_htx.c