Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix: IPv6 INTRANET_PATTERNS for local ip (see http://bugs.yacy.net/view.php?id=378) requiring following ":" for fc and fd prefix and made pattern match case insesitive - add some more ipv6 test cases to MultiProtocolURLTest.java

reger6878c90f9940
diff --git a/source/net/yacy/cora/protocol/Domains.java b/source/net/yacy/cora/protocol/Domains.java
index f476a0522..c1756bf62 100644
--- a/source/net/yacy/cora/protocol/Domains.java
+++ b/source/net/yacy/cora/protocol/Domains.java
@@ -75,8 +75,8 @@ public class Domains {
private static final Set<String> ccSLD_TLD = new HashSet<String>();
private static final String PRESENT = "";
private static final Pattern LOCALHOST_PATTERNS = Pattern.compile("(127\\..*)|(localhost)|(\\[?(fe80|0)\\:0\\:0\\:0\\:0\\:0\\:0\\:1.*)");
- private static final Pattern INTRANET_PATTERNS = Pattern.compile("(10\\..*)|(127\\..*)|(172\\.(1[6-9]|2[0-9]|3[0-1])\\..*)|(169\\.254\\..*)|(192\\.168\\..*)|(localhost)|(\\[?\\:\\:1/.*)|(\\[?fc.*)|(\\[?fd.*)|(\\[?(fe80|0)\\:0\\:0\\:0\\:0\\:0\\:0\\:1.*)");
-
+ private static final Pattern INTRANET_PATTERNS = Pattern.compile("(10\\..*)|(127\\..*)|(172\\.(1[6-9]|2[0-9]|3[0-1])\\..*)|(169\\.254\\..*)|(192\\.168\\..*)|(localhost)|(\\[?\\:\\:1/.*)|(\\[?fc.*\\:.*)|(\\[?fd.*\\:.*)|(\\[?(fe80|0)\\:0\\:0\\:0\\:0\\:0\\:0\\:1.*)", Pattern.CASE_INSENSITIVE);
+
private static final int MAX_NAME_CACHE_HIT_SIZE = 10000;
private static final int MAX_NAME_CACHE_MISS_SIZE = 1000;
private static final int CONCURRENCY_LEVEL = Runtime.getRuntime().availableProcessors() * 2;
diff --git a/test/net/yacy/cora/document/id/MultiProtocolURLTest.java b/test/net/yacy/cora/document/id/MultiProtocolURLTest.java
index af6f932fc..046083b8d 100644
--- a/test/net/yacy/cora/document/id/MultiProtocolURLTest.java
+++ b/test/net/yacy/cora/document/id/MultiProtocolURLTest.java
@@ -81,6 +81,13 @@ public class MultiProtocolURLTest {
testurls.put("http://[::1]/index.html", Boolean.TRUE);
testurls.put("http://[::1]:8090/index.html", Boolean.TRUE);
testurls.put("http://[0::1]/index.html", Boolean.TRUE);
+ testurls.put("http://[::0:1]:80/index.html", Boolean.TRUE);
+
+ testurls.put("http://[fc00:0:0:0:0:0:0:1]/index.html", Boolean.TRUE);
+ testurls.put("http://[fc00::fa01:ff]/index.html", Boolean.TRUE);
+ testurls.put("http://[fD00:0:0:0:0:0:0:1]/index.html", Boolean.TRUE);
+ testurls.put("http://[fe80:0:0:0:0:0:0:1]/index.html", Boolean.TRUE);
+ testurls.put("http://[fe80::1]/index.html", Boolean.TRUE);
// test urls for possible issue with IPv6 misinterpretation
testurls.put("http://fcedit.com", Boolean.FALSE);