]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2/htx: Get the start-line from the head when HEADERS frame is built
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 13 May 2019 09:55:10 +0000 (11:55 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 May 2019 05:42:12 +0000 (07:42 +0200)
in the H2 multiplexer, when a HEADERS frame is built before sending it, we have
the warranty the start-line is the head of the HTX message. It is safer to rely
on this fact than on the sl_pos value. For now, it's safe to use sl_pos in muxes
because HTTP 1xx messages are considered as full messages in HTX and only one
HTTP message can be stored at a time in HTX. But we are trying to handle 1xx
messages as a part of the reponse message. In this way, an HTTP reponse will be
the sum of all 1xx informational messages followed by the final response. So it
will be possible to have several start-line in the same HTX message. And the
sl_pos will point to the first unprocessed start-line from the analyzers point
of view.

src/mux_h2.c

index 2129f7f070a4e4d3a2387b2eadcb9844e3b73bd8..6ecec4d624bb961b15f07aa66c7c9c630b5208c0 100644 (file)
@@ -4438,8 +4438,10 @@ static size_t h2s_htx_frt_make_resp_headers(struct h2s *h2s, struct htx *htx)
        }
 
        /* get the start line, we do have one */
-       sl = htx_get_stline(htx);
-       ALREADY_CHECKED(sl);
+       blk = htx_get_head_blk(htx);
+       BUG_ON(htx_get_blk_type(blk) != HTX_BLK_RES_SL);
+       ALREADY_CHECKED(blk);
+       sl = htx_get_blk_ptr(htx, blk);
        h2s->status = sl->info.res.status;
        if (h2s->status < 100 || h2s->status > 999)
                goto fail;
@@ -4645,8 +4647,10 @@ static size_t h2s_htx_bck_make_req_headers(struct h2s *h2s, struct htx *htx)
        }
 
        /* get the start line, we do have one */
-       sl = htx_get_stline(htx);
-       ALREADY_CHECKED(sl);
+       blk = htx_get_head_blk(htx);
+       BUG_ON(htx_get_blk_type(blk) != HTX_BLK_REQ_SL);
+       ALREADY_CHECKED(blk);
+       sl = htx_get_blk_ptr(htx, blk);
        meth = htx_sl_req_meth(sl);
        path = htx_sl_req_uri(sl);