]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: mux-h1: search the websocket key in the right message
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 7 Oct 2026 14:36:43 +0000 (16:36 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 16 Oct 2026 17:10:27 +0000 (19:10 +0200)
commit545328d71da0653ad0db7345c7ffb1d74fea5db7
tree0316bce153c58f188d0a6734331d2036ee5cf014
parent786d7077b0d803167aca7410e1403fb55d4915ec
BUG/MINOR: mux-h1: search the websocket key in the right message

When the headers of a websocket handshake are parsed, the websocket key is
searched by h1_search_websocket_key() in the headers following the HTX
message's first block, which is supposed to be the start-line that was just
parsed. But on the server side, interim responses (1xx) may still be present
in the HTX message when the final response is parsed. So when a server sends
"HTTP/1.1 100 Continue\r\n\r\n" immediately followed by the "101 Switching
Protocols" response in the same segment, the key is searched in the 100
response, it is not found and the response is rejected with a 502, while it
is valid.

Let's loop backward on the HTX message instead, which is the one that was
just parsed.

A reg-test was added for this.

This patch could be backported to all supported versions.
reg-tests/http-messaging/h1_ws_1xx_101_same_read.vtc [new file with mode: 0644]
src/mux_h1.c