]> git.sesse.net Git - cubemap/blobdiff - httpinput.cpp
Fix HTTP connections to IPv6 address literals.
[cubemap] / httpinput.cpp
index 4980fc170c2e721a07abb80fe6635916537cca71..069572753eaef9b04617eb2f1329f8e8e26615f1 100644 (file)
@@ -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);