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:
Frederic Lecaille 2026-07-08 17:34:30 +02:00
parent 7f37cf8cc0
commit 3248ba100d

View file

@ -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);
}