]> sjero.net Git - wget/commitdiff
Show the hostname we are connecting to in the locale when possible
authorSaint Xavier <wget@sxav.eu>
Mon, 7 Jul 2008 22:42:09 +0000 (00:42 +0200)
committerSaint Xavier <wget@sxav.eu>
Mon, 7 Jul 2008 22:42:09 +0000 (00:42 +0200)
src/connect.c

index a6ff0b9bcfdd51147190831e3c221d517907de24..6cfdb4b73f6b310632419a461c2e982e8a3033da 100644 (file)
@@ -58,6 +58,7 @@ as that of the covered work.  */
 #include "host.h"
 #include "connect.h"
 #include "hash.h"
+#include "iri.h"
 
 /* Define sockaddr_storage where unavailable (presumably on IPv4-only
    hosts).  */
@@ -267,8 +268,24 @@ connect_to_ip (const ip_address *ip, int port, const char *print)
     {
       const char *txt_addr = print_address (ip);
       if (0 != strcmp (print, txt_addr))
-        logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
-                   escnonprint_uri (print), txt_addr, port);
+        {
+                                 char *str = NULL, *name;
+
+          if (opt.enable_iri && (name = idn_decode ((char *) print)) != NULL)
+            {
+              int len = strlen (print) + strlen (name) + 4;
+              str = xmalloc (len);
+              snprintf (str, len, "%s (%s)", name, print);
+              str[len-1] = '\0';
+              xfree (name);
+            }
+
+          logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
+                     str ? str : escnonprint_uri (print), txt_addr, port);
+
+                                       if (str)
+                                         xfree (str);
+        }
       else
         logprintf (LOG_VERBOSE, _("Connecting to %s:%d... "), txt_addr, port);
     }