BUG/MEDIUM: http: functions set-{path,query,method,uri} breaks the HTTP parser

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.
This commit is contained in:
Thierry FOURNIER 2015-04-26 18:01:40 +02:00 committed by Willy Tarreau
parent e91ffd093e
commit 7f6192c0d3

View File

@ -11825,6 +11825,8 @@ int http_replace_req_line(int action, const char *replace, int len,
/* commit changes and adjust end of message */ /* commit changes and adjust end of message */
delta = buffer_replace2(s->req.buf, cur_ptr, cur_end, replace + offset, len - offset); 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); http_msg_move_end(&txn->req, delta);
return 0; return 0;
} }