]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/ip/hproxy.c
ip/torrent: remove unneeded assignment
[plan9front.git] / sys / src / cmd / ip / hproxy.c
index ba8025cdf1defd28dcba9e7396dddc6c353a7889..5b50a8d281da1120d17394074bf3cf1ad199740a 100644 (file)
@@ -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);
 
@@ -85,7 +88,7 @@ main(void)
        default:
                dup(fd, 1);
                if(!con)
-                       print("%s /%s %s\r\n%s", f[0], path, f[2], e);
+                       print("%s /%s %s\r\nConnection: close\r\n%s", f[0], path, f[2], e);
        }
 
        while((r = read(0, buf, sizeof(buf))) > 0)