]> git.kaiwu.me - haproxy.git/commit
REGTESTS: http-messaging: add tests for the H2 and H3 trailers
authorWilly Tarreau <w@1wt.eu>
Tue, 8 Sep 2026 08:03:10 +0000 (10:03 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 8 Sep 2026 12:50:50 +0000 (14:50 +0200)
commit6991158499b139a07f92c9677a354e6638b9f6fd
tree9bdfd10e2b1b2bd06b099afef858254e702b11a0
parent28a00d7d248f1fe5cb03a01c515698c0fb4dbac5
REGTESTS: http-messaging: add tests for the H2 and H3 trailers

Two new tests cover the trailers parsers of the H2 and the H3 muxes, so
that any change to these parsers can be checked against the current
behaviour.

h2_trailers.vtc checks that valid trailers are forwarded with their
leading and trailing spaces removed, on the request as well as on the
response path, and that all the trailers rejected by the parser cause
the stream to be reset: literal and indexed pseudo-headers, upper case
letters and non-token characters in the names, NUL/CR/LF in the values,
and the fields affecting the message framing or the routing.

Since vtest doesn't speak H3, h3_trailers.vtc stacks two HTTP layers in
the same haproxy: the H2 requests emitted by vtest are converted to H3
and sent over a local qmux connection to a second frontend which
converts them back to H2 for the vtest servers. Only valid trailers are
checked there because the invalid ones cannot reach the H3 parser: HTX
lower cases the trailer names and the H3 mux drops the trailers which
are forbidden on the wire.

A few notes about the tricks used in these tests:
  - a trailers frame is emitted using "txreq -noadd", which sends a
    HEADERS frame with ES+EH set and no pseudo-header at all ;
  - trailers vtest cannot encode (a NUL in a value) or decode (an empty
    value as the last field) are crafted by hand with sendhex ;
  - haproxy doesn't ack the settings of an H2 server before it has
    something else to send, so the servers must not wait for that ack ;
  - the window update emitted after the request headers is consumed
    before sending invalid trailers, so that the reset is necessarily
    the next frame to be received ;
  - "option http-buffer-request" makes sure the invalid trailers are
    detected while the stream is still open and that no server is
    involved.
reg-tests/http-messaging/h2_trailers.vtc [new file with mode: 0644]
reg-tests/http-messaging/h3_trailers.vtc [new file with mode: 0644]