From 2c1c1e40055c4cd4c414d90e9d0c8286e339810f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Thu, 20 Dec 2012 22:15:52 +0100 Subject: hproxy: fix ipv6 url parsing --- sys/src/cmd/ip/hproxy.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/src/cmd/ip/hproxy.c b/sys/src/cmd/ip/hproxy.c index d1c355bfc..5b50a8d28 100644 --- a/sys/src/cmd/ip/hproxy.c +++ b/sys/src/cmd/ip/hproxy.c @@ -51,14 +51,17 @@ main(void) *p++ = 0; path = p; } - if(*host == '[') + if(*host == '['){ host++; - if(p = strrchr(host, ':')){ + if(p = strrchr(host, ']')){ + *p++ = 0; + if(p = strrchr(p, ':')) + port = ++p; + } + } else if(p = strrchr(host, ':')){ *p++ = 0; port = p; } - if(p = strrchr(host, ']')) - *p = 0; snprint(addr, sizeof(addr), "tcp!%s!%s", host, port); -- cgit v1.2.3