mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
BUG/MINOR: http: Return an error in proxy mode when url2sa fails
In proxy mode, the result of url2sa is never checked. So when the function fails to resolve the destination server from the URL, we continue. Depending on the internal state of the connection, we get different behaviours. With a newly allocated connection, the field <addr.to> is not set. So we will get a HTTP error. The status code is 503 instead of 400, but it's not really critical. But, if it's a recycled connection, we will reuse the previous value of <addr.to>, opening a connection on an unexpected server. To fix the bug, we return an error when url2sa fails. This patch should be backported in all version from 1.5.
This commit is contained in:
parent
302f9ef055
commit
11ebb2080e
@ -3720,9 +3720,11 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
}
|
||||
|
||||
path = http_get_path(txn);
|
||||
url2sa(req->buf->p + msg->sl.rq.u,
|
||||
path ? path - (req->buf->p + msg->sl.rq.u) : msg->sl.rq.u_l,
|
||||
&conn->addr.to, NULL);
|
||||
if (url2sa(req->buf->p + msg->sl.rq.u,
|
||||
path ? path - (req->buf->p + msg->sl.rq.u) : msg->sl.rq.u_l,
|
||||
&conn->addr.to, NULL) == -1)
|
||||
goto return_bad_req;
|
||||
|
||||
/* if the path was found, we have to remove everything between
|
||||
* req->buf->p + msg->sl.rq.u and path (excluded). If it was not
|
||||
* found, we need to replace from req->buf->p + msg->sl.rq.u for
|
||||
|
Loading…
Reference in New Issue
Block a user