mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-10 19:21:37 +00:00
BUG/MINOR: http-htx: Don't return error if authority is updated without changes
When an Host header is updated, the autority part, if any, is also updated to keep the both syncrhonized. But, when the update is performed while there is no change, a failure is reported while, in reality, no update is necessary. This bug was introduced by the commitd7b7a1ce5
("MEDIUM: http-htx: Keep the Host header and the request start-line synchronized"). This commit was pushed in the 2.1. But on this version, the bug is hidden because rewrite errors are silently ignored. And because it happens when there is no change, if the rewrite fails, noone notices it. But since the 2.2, rewrite errors are now fatals by default. So when the bug is hit, a 500 error is returned to the client. Without this fix, a workaround is to disable the strict rewriting mode (see the "strict-mode" HTTP rule). The following HTTP rule is a good way to reproduce the bug if a request with an authority is received. In HTT2, it is pretty common. acl host_header_exists req.hdr(host) -m found http-request set-header host %[req.hdr(host)] if host_header_exists This patch must be backported to 2.1 and everywhere the commitd7b7a1ce5
is backported. It should fix the issue #494.
This commit is contained in:
parent
9c44e4813c
commit
34b18e4391
@ -584,9 +584,13 @@ static int http_update_authority(struct htx *htx, struct htx_sl *sl, const struc
|
||||
|
||||
uri = htx_sl_req_uri(sl);
|
||||
authority = http_get_authority(uri, 1);
|
||||
if (!authority.len || isteq(host, authority))
|
||||
if (!authority.len)
|
||||
return 0;
|
||||
|
||||
/* Don't update the uri if there is no change */
|
||||
if (isteq(host, authority))
|
||||
return 1;
|
||||
|
||||
/* Start by copying old method and version */
|
||||
chunk_memcat(temp, HTX_SL_REQ_MPTR(sl), HTX_SL_REQ_MLEN(sl)); /* meth */
|
||||
meth = ist2(temp->area, HTX_SL_REQ_MLEN(sl));
|
||||
|
Loading…
Reference in New Issue
Block a user