mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-16 00:14:31 +00:00
BUG/MEDIUM: http_ana: fix crash for http_proxy mode during uri rewrite
Fix the wrong usage of http_uri_parser which is defined with an
uninitialized uri. This causes a crash which happens when forwarding a
request to a backend configured in plain proxy ('option http_proxy').
This has been reported through a clang warning on the CI.
This bug has been introduced by the refactoring of URI parser API.
c453f9547e
MINOR: http: use http uri parser for path
This does not need to be backported.
WARNING: although this patch fix the crash, the 'option http_proxy'
seems to be non buggy, possibly since quite a few stable versions.
Indeed, the URI rewriting is not functional : the path is written on the
beginning of the URI but the rest of the URI is not and this garbage is
passed to the server which does not understand the request.
This commit is contained in:
parent
c453f9547e
commit
b60fb8d5be
@ -623,7 +623,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
if ((s->be->options & PR_O_HTTP_PROXY) && !(s->flags & SF_ADDR_SET)) {
|
||||
struct htx_sl *sl;
|
||||
struct ist uri, path;
|
||||
struct http_uri_parser parser = http_uri_parser_init(uri);
|
||||
struct http_uri_parser parser;
|
||||
|
||||
if (!sockaddr_alloc(&s->target_addr, NULL, 0)) {
|
||||
if (!(s->flags & SF_ERR_MASK))
|
||||
@ -632,6 +632,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
||||
}
|
||||
sl = http_get_stline(htx);
|
||||
uri = htx_sl_req_uri(sl);
|
||||
parser = http_uri_parser_init(uri);
|
||||
path = http_parse_path(&parser);
|
||||
|
||||
if (url2sa(uri.ptr, uri.len - path.len, s->target_addr, NULL) == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user