1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Show the hostname we are connecting to in the locale when possible

This commit is contained in:
Saint Xavier 2008-07-08 00:42:09 +02:00
parent 3781197ec6
commit f50be2a403

View File

@ -58,6 +58,7 @@ as that of the covered work. */
#include "host.h" #include "host.h"
#include "connect.h" #include "connect.h"
#include "hash.h" #include "hash.h"
#include "iri.h"
/* Define sockaddr_storage where unavailable (presumably on IPv4-only /* Define sockaddr_storage where unavailable (presumably on IPv4-only
hosts). */ hosts). */
@ -267,8 +268,24 @@ connect_to_ip (const ip_address *ip, int port, const char *print)
{ {
const char *txt_addr = print_address (ip); const char *txt_addr = print_address (ip);
if (0 != strcmp (print, txt_addr)) if (0 != strcmp (print, txt_addr))
{
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... "), logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
escnonprint_uri (print), txt_addr, port); str ? str : escnonprint_uri (print), txt_addr, port);
if (str)
xfree (str);
}
else else
logprintf (LOG_VERBOSE, _("Connecting to %s:%d... "), txt_addr, port); logprintf (LOG_VERBOSE, _("Connecting to %s:%d... "), txt_addr, port);
} }