From 3afd81df9b58a1a0356a1104bb80d17165f5787b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sun, 17 Aug 2014 16:17:11 +0200 Subject: Deal better with displaying IPv6 addresses --- common.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'common.c') diff --git a/common.c b/common.c index 782572d..25bf761 100644 --- a/common.c +++ b/common.c @@ -1604,6 +1604,15 @@ xssl_get_error (SSL *ssl, int result, const char **error_info) } } +static char * +format_host_port_pair (const char *host, const char *port) +{ + // IPv6 addresses mess with the "colon notation"; let's go with RFC 2732 + if (strchr (host, ':')) + return xstrdup_printf ("[%s]:%s", host, port); + return xstrdup_printf ("%s:%s", host, port); +} + // --- Regular expressions ----------------------------------------------------- static regex_t * -- cgit v1.2.3