mirror of
https://github.com/haproxy/haproxy.git
synced 2026-07-10 01:34:36 -04:00
MINOR: haload: allow "0" shortcut for IPv4 bind address
The address parser was failing when using "0" as a shortcut for INADDR_ANY. This patch intercepts the "0" prefix and normalizes it to "0.0.0.0" before the address is parsed.
This commit is contained in:
parent
7f37cf8cc0
commit
3248ba100d
1 changed files with 6 additions and 1 deletions
|
|
@ -187,7 +187,7 @@ static struct hld_url_cfg *hld_alloc_url(char *url)
|
|||
struct hld_url_cfg *purl;
|
||||
struct hld_path *p = NULL;
|
||||
struct hbuf opts_buf = HBUF_NULL;
|
||||
char quic_addr[128];
|
||||
char quic_addr[128], tmp_addr[16];
|
||||
|
||||
if (strncmp(url, "http://", 7) == 0)
|
||||
addr = url + 7;
|
||||
|
|
@ -250,6 +250,11 @@ static struct hld_url_cfg *hld_alloc_url(char *url)
|
|||
}
|
||||
}
|
||||
|
||||
if (addr[0] == '0' && addr[1] == ':') {
|
||||
snprintf(tmp_addr, sizeof(tmp_addr), "0.0.0.0:%s", addr + 2);
|
||||
addr = tmp_addr;
|
||||
}
|
||||
|
||||
if (!is_quic) {
|
||||
addr = strdup(addr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue