]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stats/htx: don't use the first block position but the head one
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 May 2019 09:04:05 +0000 (11:04 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 May 2019 05:42:33 +0000 (07:42 +0200)
Applets must never rely on the first block position to consume an HTX
message. The head position must be used instead. For the request it is always
the start-line. At this stage, it is not a bug, because the first position of
the request is never changed by HTX analysers.

src/stats.c

index a8f9795c905d20b8a27dd7c356d288d9e6594f23..9c3bf7c14f1ae2ff8d4b47b352464091200d5da8 100644 (file)
@@ -277,8 +277,13 @@ static const char *stats_scope_ptr(struct appctx *appctx, struct stream_interfac
        if (IS_HTX_STRM(si_strm(si))) {
                struct channel *req = si_oc(si);
                struct htx *htx = htxbuf(&req->buf);
-               struct ist uri = htx_sl_req_uri(http_get_stline(htx));
+               struct htx_blk *blk;
+               struct ist uri;
 
+               blk = htx_get_head_blk(htx);
+               BUG_ON(htx_get_blk_type(blk) != HTX_BLK_REQ_SL);
+               ALREADY_CHECKED(blk);
+               uri = htx_sl_req_uri(htx_get_blk_ptr(htx, blk));
                p = uri.ptr;
        }
        else
@@ -2788,7 +2793,7 @@ static int stats_process_http_post(struct stream_interface *si)
                }
 
                /* The request was fully received. Copy data */
-               blk = htx_get_first_blk(htx);
+               blk = htx_get_head_blk(htx);
                while (blk) {
                        enum htx_blk_type type = htx_get_blk_type(blk);