From e5a0a0943b91a64ee0cd71314546f0876df7789b Mon Sep 17 00:00:00 2001 From: Tanguy Moal Date: Thu, 30 Jul 2015 11:08:40 +0200 Subject: [PATCH] HttpBase: fix bug when http.content.limit is set to -1 and remote server uses deflate encoding --- .../java/org/apache/nutch/protocol/http/api/HttpBase.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 5181ddae82..d3b45213b1 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 byte[] processDeflateEncoded(byte[] compressed, URL url) 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");