From f25d2a3d3fa434c50dbe117d0cb125bc0a892b02 Mon Sep 17 00:00:00 2001 From: zzz Date: Mon, 11 May 2015 00:08:26 +0000 Subject: [PATCH] Util: Fix corruption of cached ReusableGZIPInputStreams, caused by calling close() from HTTPResponseOutputStream.Pusher, but close() rendered the underlying InflaterInputStream unusable. Broken in -15. Caused failed HTTP fetches and other flakiness. --- .../net/i2p/util/ResettableGZIPInputStream.java | 15 +++++++++++++++ history.txt | 4 ++++ router/java/src/net/i2p/router/RouterVersion.java | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/core/java/src/net/i2p/util/ResettableGZIPInputStream.java b/core/java/src/net/i2p/util/ResettableGZIPInputStream.java index dee068202..b7a163e59 100644 --- a/core/java/src/net/i2p/util/ResettableGZIPInputStream.java +++ b/core/java/src/net/i2p/util/ResettableGZIPInputStream.java @@ -168,6 +168,21 @@ public class ResettableGZIPInputStream extends InflaterInputStream { } } + /** + * Does NOT call super.close(), as it cannot be reused if we do that. + * Broken before 0.9.20. + * @since 0.9.20 + */ + @Override + public void close() throws IOException { + len = 0; + inf.reset(); + _complete = false; + _crc32.reset(); + _buf1[0] = 0x0; + _extraByteInputStream.close(); + } + /** * Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStream * @since 0.8.9 diff --git a/history.txt b/history.txt index 14c134dbe..dee09afc2 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,8 @@ +2015-05-11 zzz + * Util: Fix corruption of cached ReusableGZIPInputStreams + 2015-05-09 zzz + * i2ptunnel: Improve error handling in UDP tunnels * Plugins: Add support for custom icons (ticket #1550) 2015-05-08 zzz diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 987fc2f75..78754ef28 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 19; + public final static long BUILD = 20; /** for example "-test" */ public final static String EXTRA = "-rc";