diff options
| author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-20 22:15:52 +0100 |
|---|---|---|
| committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-20 22:15:52 +0100 |
| commit | 2c1c1e40055c4cd4c414d90e9d0c8286e339810f (patch) | |
| tree | e54b5593665954cbd0f6ab936183e5cd328bb057 | |
| parent | e2d6bba40d79ce8b59c2a8b49f6d7241183ae15a (diff) | |
| download | plan9front-2c1c1e40055c4cd4c414d90e9d0c8286e339810f.tar.xz | |
hproxy: fix ipv6 url parsing
| -rw-r--r-- | sys/src/cmd/ip/hproxy.c | 11 |
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); |
