From 0efc6c89efc735794be623f7042faa2c7b08c3f8 Mon Sep 17 00:00:00 2001 From: luccioman Date: Mon, 13 Aug 2018 14:36:22 +0200 Subject: [PATCH] Fixed rendering of crawl queues page for URLs with raw IPV6 addresses --- htroot/IndexCreateQueues_p.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htroot/IndexCreateQueues_p.java b/htroot/IndexCreateQueues_p.java index 96c135067..27f0b4aae 100644 --- a/htroot/IndexCreateQueues_p.java +++ b/htroot/IndexCreateQueues_p.java @@ -13,6 +13,8 @@ import java.util.Set; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import org.apache.http.conn.util.InetAddressUtils; + import net.yacy.cora.date.GenericFormatter; import net.yacy.cora.document.encoding.ASCII; import net.yacy.cora.document.id.DigestURL; @@ -153,6 +155,9 @@ public class IndexCreateQueues_p { for (Map.Entry host: hosts.entrySet()) { String hostnameport = host.getKey(); String hostname = Domains.stripToHostName(hostnameport); + if(InetAddressUtils.isIPv6Address(hostname)) { + hostname = "[" + hostname + "]"; // HostBalancer.getDomainStackReferences() function requires square brackets around IPV6 addresses + } prop.putHTML("crawler_host_" + hc + "_hostnameport", hostnameport); prop.putHTML("crawler_host_" + hc + "_hostname", hostname); prop.put("crawler_host_" + hc + "_embed", embed ? 1 : 0);