ref: 2c1c1e40055c4cd4c414d90e9d0c8286e339810f
parent: e2d6bba40d79ce8b59c2a8b49f6d7241183ae15a
author: cinap_lenrek <[email protected]>
date: Thu Dec 20 17:15:52 EST 2012
hproxy: fix ipv6 url parsing
--- a/sys/src/cmd/ip/hproxy.c
+++ b/sys/src/cmd/ip/hproxy.c
@@ -51,14 +51,17 @@
*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);