From 09d667c49383edb980bcac88de1173c452066128 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 26 Jul 2020 16:45:11 -0700 Subject: fixes #844 WebSocket wildcard host errors fixes #1224 wss fails on IPV6 address This fixes bugs and inconsistencies in the way addresses are handled for HTTP (and consequently websocket). The Host: address line needs to look at numeric IPs and treat wildcards as if they are not specified, and needs to understand the IPv6 address format using brackets (e.g. [::1]:80). --- src/supplemental/tcp/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/supplemental/tcp/tcp.c') diff --git a/src/supplemental/tcp/tcp.c b/src/supplemental/tcp/tcp.c index dd6f28ff..2fb7f56d 100644 --- a/src/supplemental/tcp/tcp.c +++ b/src/supplemental/tcp/tcp.c @@ -439,7 +439,7 @@ nni_tcp_listener_alloc(nng_stream_listener **lp, const nng_url *url) h = url->u_hostname; // Wildcard special case, which means bind to INADDR_ANY. - if ((h != NULL) && ((strcmp(h, "*") == 0) || (strlen(h) == 0))) { + if ((h != NULL) && ((strcmp(h, "*") == 0) || (strcmp(h, "") == 0))) { h = NULL; } nni_tcp_resolv(h, url->u_port, af, 1, aio); -- cgit v1.2.3-70-g09d2