]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Feature] http: optional insertion-ordered header emission
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 22 May 2026 09:36:36 +0000 (10:36 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 22 May 2026 09:36:36 +0000 (10:36 +0100)
commitf7720651eddaed87626753bf7f7283bd5efd9902
tree251cb8b7943732dd5ca4dc0e7e8c0fa1cca8adff
parent3a179c89827e8f6cbb39ed6e5b031c931d38c2bf
[Feature] http: optional insertion-ordered header emission

The HTTP client stores headers in a khash and emits them in bucket
order, so the on-the-wire header order is unpredictable. Add an opt-in
RSPAMD_HTTP_FLAG_ORDERED_HEADERS flag: each header is stamped with a
monotonic `order` at insertion time, and when the flag is set the
client serialises headers sorted by that order instead of hash order.

lua_http now accepts a list form for the headers table
({{'name', 'value'}, ...}) which preserves order and sets the flag;
the existing map form and every other caller are byte-identical.

This lets callers reproduce a real browser's exact header order, used
by the url_redirector stealth fingerprint profiles.
src/libserver/http/http_connection.c
src/libserver/http/http_connection.h
src/libserver/http/http_message.c
src/libserver/http/http_private.h
src/lua/lua_http.c