Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-374: when http.content.limit be set to -1 and Response.CONTENT_ENCODING is gzip or x-gzip , it can not fetch any thing.(King Kong)

Piotr Kosiorowski37628d528fc2
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 6cdd7826a..da98b84d7 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
@@ -464,7 +464,12 @@ public abstract class HttpBase implements Protocol {
if (LOGGER.isTraceEnabled()) { LOGGER.trace("uncompressing...."); }
- byte[] content = GZIPUtils.unzipBestEffort(compressed, getMaxContent());
+ byte[] content;
+ if (getMaxContent() >= 0) {
+ content = GZIPUtils.unzipBestEffort(compressed, getMaxContent());
+ } else {
+ content = GZIPUtils.unzipBestEffort(compressed);
+ }
if (content == null)
throw new IOException("unzipBestEffort returned null");