]> sjero.net Git - wget/blobdiff - src/http.c
Properly format IPv6 addresses.
[wget] / src / http.c
index 6a2ffe86aa0b5c44d62aaf124d43978e8754d4cb..69789fcd4770da72ecdaf962e7f38b4c893b8c1b 100644 (file)
@@ -1951,11 +1951,17 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
 #endif
                                   &host_lookup_failed))
         {
+          int family = socket_family (pconn.socket, ENDPOINT_PEER);
           sock = pconn.socket;
           using_ssl = pconn.ssl;
-          logprintf (LOG_VERBOSE, _("Reusing existing connection to %s:%d.\n"),
-                     quotearg_style (escape_quoting_style, pconn.host),
-                     pconn.port);
+          if (family == AF_INET6)
+             logprintf (LOG_VERBOSE, _("Reusing existing connection to [%s]:%d.\n"),
+                        quotearg_style (escape_quoting_style, pconn.host),
+                         pconn.port);
+          else
+             logprintf (LOG_VERBOSE, _("Reusing existing connection to %s:%d.\n"),
+                        quotearg_style (escape_quoting_style, pconn.host),
+                        pconn.port);
           DEBUGP (("Reusing fd %d.\n", sock));
           if (pconn.authorized)
             /* If the connection is already authorized, the "Basic"