From 927a64c9c50f3ce5cf8285ce3ee1dc9f2985d746 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 17 Apr 2021 09:59:04 +0300 Subject: Parsing an IPv6 URL The brackets are part of the URL notation and should not be considered part of the IPv6 address itself. --- src/gmutil.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gmutil.c b/src/gmutil.c index df77a3e0..34132015 100644 --- a/src/gmutil.c +++ b/src/gmutil.c @@ -61,6 +61,11 @@ void init_Url(iUrl *d, const iString *text) { d->host = capturedRange_RegExpMatch(&m, 3); d->port = capturedRange_RegExpMatch(&m, 7); } + /* Remove brackets from an IPv6 literal. */ + if (size_Range(&d->host) > 2 && d->host.start[0] == '[' && d->host.end[-1] == ']') { + d->host.start++; + d->host.end--; + } } } -- cgit v1.2.3