Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-1767 remove special treatment of "params" in relative links

Sebastian Nagel02fda7de9b7d
diff --git a/CHANGES.txt b/CHANGES.txt
index 07b4ac380..d546c5a7a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Nutch Current Development
+* NUTCH-1767 remove special treatment of "params" in relative links (snagel)
+
* NUTCH-1718 redefine http.robots.agent as "additional agent names" (snagel, Tejas Patil, Daniel Kugel)
* NUTCH-1794 IndexingFilterChecker to optionally dumpText (markus)
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xml
index 59493be60..fb574b005 100644
--- a/conf/nutch-default.xml
+++ b/conf/nutch-default.xml
@@ -1127,13 +1127,6 @@
for most people would be "img,script,link".</description>
</property>
-<property>
- <name>parser.fix.embeddedparams</name>
- <value>true</value>
- <description>Whether to fix URL embedded params using semi-colons.
- See NUTCH-436 and NUTCH-1115</description>
-</property>
-
<property>
<name>htmlparsefilter.order</name>
<value></value>
diff --git a/src/java/org/apache/nutch/util/URLUtil.java b/src/java/org/apache/nutch/util/URLUtil.java
index cfdbe2f7b..1a59b2382 100644
--- a/src/java/org/apache/nutch/util/URLUtil.java
+++ b/src/java/org/apache/nutch/util/URLUtil.java
@@ -28,9 +28,8 @@ import org.apache.nutch.util.domain.DomainSuffixes;
public class URLUtil {
/**
- * Resolve relative URL-s and fix a few java.net.URL errors
- * in handling of URLs with embedded params and pure query
- * targets.
+ * Resolve relative URL-s and fix a java.net.URL error
+ * in handling of URLs with pure query targets.
* @param base base url
* @param target target url (may be relative)
* @return resolved absolute url.
@@ -40,13 +39,6 @@ public class URLUtil {
throws MalformedURLException {
target = target.trim();
- /* this is probably not needed anymore - see NUTCH-797.
- // handle params that are embedded into the base url - move them to target
- // so URL class constructs the new url class properly
- if (base.toString().indexOf(';') > 0)
- return fixEmbeddedParams(base, target);
- */
-
// handle the case that there is a target that is a pure query,
// for example
// http://careers3.accenture.com/Careers/ASPX/Search.aspx?co=0&sk=0
@@ -82,53 +74,6 @@ public class URLUtil {
return new URL(base, target);
}
- /**
- * Handles cases where the url param information is encoded into the base url
- * as opposed to the target.
- * <p>
- * If the taget contains params (i.e. ';xxxx') information then the target
- * params information is assumed to be correct and any base params information
- * is ignored. If the base contains params information but the tareget does
- * not, then the params information is moved to the target allowing it to be
- * correctly determined by the java.net.URL class.
- *
- * @param base
- * The base URL.
- * @param target
- * The target path from the base URL.
- *
- * @return URL A URL with the params information correctly encoded.
- *
- * @throws MalformedURLException
- * If the url is not a well formed URL.
- */
- private static URL fixEmbeddedParams(URL base, String target)
- throws MalformedURLException {
-
- // the target contains params information or the base doesn't then no
- // conversion necessary, return regular URL
- if (target.indexOf(';') >= 0 || base.toString().indexOf(';') == -1) {
- return new URL(base, target);
- }
-
- // get the base url and it params information
- String baseURL = base.toString();
- int startParams = baseURL.indexOf(';');
- String params = baseURL.substring(startParams);
-
- // if the target has a query string then put the params information after
- // any path but before the query string, otherwise just append to the path
- int startQS = target.indexOf('?');
- if (startQS >= 0) {
- target = target.substring(0, startQS) + params
- + target.substring(startQS);
- } else {
- target += params;
- }
-
- return new URL(base, target);
- }
-
private static Pattern IP_PATTERN = Pattern.compile("(\\d{1,3}\\.){3}(\\d{1,3})");
/** Returns the domain name of the url. The domain name of a url is