From 8077fd7663c0e79e4d42c9db55be1de02027a17d Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 29 Mar 2016 00:36:57 +0200 Subject: [PATCH] Fix HTTP connections to IPv6 address literals. --- httpinput.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/httpinput.cpp b/httpinput.cpp index 4980fc1..0695727 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -328,6 +328,13 @@ void HTTPInput::do_work() log(WARNING, "[%s] Failed to parse URL '%s'", url.c_str(), url.c_str()); break; } + + // Remove the brackets around IPv6 address literals. + // TODO: See if we can join this with the code in parse_ip_address(), + // or maybe even more it into parse_url(). + if (!host.empty() && host[0] == '[' && host[host.size() - 1] == ']') { + host = host.substr(1, host.size() - 2); + } } sock = lookup_and_connect(host, port); -- 2.39.2