From 6878c90f99407cba409302528436c8adc359be41 Mon Sep 17 00:00:00 2001 From: reger Date: Sun, 2 Mar 2014 06:13:21 +0100 Subject: [PATCH] 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 --- source/net/yacy/cora/protocol/Domains.java | 4 ++-- test/net/yacy/cora/document/id/MultiProtocolURLTest.java | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) 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 ccSLD_TLD = new HashSet(); 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);