]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http: functions set-{path,query,method,uri} breaks the HTTP parser
authorThierry FOURNIER <tfournier@haproxy.com>
Sun, 26 Apr 2015 16:01:40 +0000 (18:01 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 Apr 2015 09:56:52 +0000 (11:56 +0200)
When one of these functions replaces a part of the query string by
a shorter or longer new one, the header parsing is broken. This is
because the start of the first header is not updated.

In the same way, the total length of the request line is not updated.
I dont see any bug caused by this miss, but I guess than it is better
to store the good length.

This bug is only in the development version.

src/proto_http.c

index d20225a921325f13f32b7292470b5a8f405f8967..6bb0745eecdd4a780d105928d71f0f2ddf0514d1 100644 (file)
@@ -11825,6 +11825,8 @@ int http_replace_req_line(int action, const char *replace, int len,
 
        /* commit changes and adjust end of message */
        delta = buffer_replace2(s->req.buf, cur_ptr, cur_end, replace + offset, len - offset);
+       txn->req.sl.rq.l += delta;
+       txn->hdr_idx.v[0].len += delta;
        http_msg_move_end(&txn->req, delta);
        return 0;
 }