--- wget-1.12/src/http.c	2011-10-18 12:11:06.000000000 +0200
+++ wget-1.12.new/src/http.c	2011-10-18 12:13:13.000000000 +0200
@@ -1698,8 +1698,10 @@
           /* When requesting SSL URLs through proxies, use the
              CONNECT method to request passthrough.  */
           struct request *connreq = request_new ();
+          static const char hfmt[2] = { "%s:%d", "[%s]:%d" };
+          int add_squares = strchr (u->host, ':') != NULL;
           request_set_method (connreq, "CONNECT",
-                              aprintf ("%s:%d", u->host, u->port));
+                              aprintf (hfmt[add_squaresd"%s:%d", u->host, u->port));
           SET_USER_AGENT (connreq);
           if (proxyauth)
             {
