Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

Fix for NUTCH-2072: Deflate encoding support is broken when http.content.limit is set to -1 contributed by Tanguy Moal <[email protected]> this closes #48.

Chris Mattmannd2dad5d346d3
diff --git a/CHANGES.txt b/CHANGES.txt
index d7686222c..9d80da9c2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,6 +2,8 @@ Nutch Change Log
Nutch Current Development 1.11-SNAPSHOT
+* NUTCH-2072 Deflate encoding support is broken when http.content.limit is set to -1 (Tanguy Moal via mattmann)
+
* NUTCH-2062 Add Plugin for interacting with Selenium WebDriver (Michael Joyce, mattmann)
* NUTCH-1785 Ability to index raw content (markus, lewismc)
diff --git a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
index 5181ddae8..d3b45213b 100644
--- a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
+++ b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
@@ -495,8 +495,12 @@ public abstract class HttpBase implements Protocol {
LOGGER.trace("inflating....");
}
- byte[] content = DeflateUtils
- .inflateBestEffort(compressed, getMaxContent());
+ byte[] content;
+ if (getMaxContent() >= 0) {
+ content = DeflateUtils.inflateBestEffort(compressed, getMaxContent());
+ } else {
+ content = DeflateUtils.inflateBestEffort(compressed);
+ }
if (content == null)
throw new IOException("inflateBestEffort returned null");