summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-12-20 22:15:52 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2012-12-20 22:15:52 +0100
commit2c1c1e40055c4cd4c414d90e9d0c8286e339810f (patch)
treee54b5593665954cbd0f6ab936183e5cd328bb057
parente2d6bba40d79ce8b59c2a8b49f6d7241183ae15a (diff)
downloadplan9front-2c1c1e40055c4cd4c414d90e9d0c8286e339810f.tar.xz
hproxy: fix ipv6 url parsing
-rw-r--r--sys/src/cmd/ip/hproxy.c11
1 files 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);