]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: mux-h1: loop on HTX blocks using _blk() functions to look for WS key
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 Jul 2026 08:58:58 +0000 (10:58 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 24 Jul 2026 09:58:25 +0000 (11:58 +0200)
In h1_search_websocket_key() function, instead of looping on the block
position, we now use functions returning a blocks. This commit is mandatory
for next changes.

src/mux_h1.c

index 3d95f042f367ac45f147cd10dab10846fbdcf5a3..81ac9b371fef08dd48e2ed7f6e5e8823e2c38596 100644 (file)
@@ -1918,11 +1918,10 @@ static int h1_search_websocket_key(struct h1s *h1s, struct h1m *h1m, struct htx
        struct htx_blk *blk;
        enum htx_blk_type type;
        struct ist n, v;
-       int ws_key_found = 0, idx;
+       int ws_key_found = 0;
 
-       idx = htx_get_head(htx); // returns the SL that we skip
-       while ((idx = htx_get_next(htx, idx)) != -1) {
-               blk = htx_get_blk(htx, idx);
+       blk = htx_get_head_blk(htx); // returns the SL that we skip
+       for (blk = htx_get_next_blk(htx, blk); blk; blk = htx_get_next_blk(htx, blk)) {
                type = htx_get_blk_type(blk);
 
                if (type == HTX_BLK_UNUSED)