From cc7a8028d194ca81341273e844a69dce17ba6e32 Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 24 Sep 2011 21:49:19 +0000 Subject: [PATCH] * HTTPClient: Fix error page not appearing, broken by StreamForwarder change --- .../java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java | 11 +++++++++-- history.txt | 5 +++++ router/java/src/net/i2p/router/RouterVersion.java | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java index 33d46238db..02a1523f67 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java @@ -76,7 +76,8 @@ public class I2PTunnelRunner extends I2PAppThread implements I2PSocket.SocketErr * @param initialSocketData may be null * @param sockList may be null. Caller must add i2ps to the list! It will be removed here on completion. * Will synchronize on slock when removing. - * @param onTimeout may be null + * @param onTimeout May be null. If non-null and no data (except initial data) was sent or received, + it will be run before closing s. */ public I2PTunnelRunner(Socket s, I2PSocket i2ps, Object slock, byte[] initialI2PData, byte[] initialSocketData, List sockList, Runnable onTimeout) { @@ -384,7 +385,13 @@ public class I2PTunnelRunner extends I2PAppThread implements I2PSocket.SocketErr // or else input end gives up and we have data loss. // http://techtavern.wordpress.com/2008/07/16/whats-this-ioexception-write-end-dead/ //out.flush(); - out.close(); + // DON'T close if we have a timeout job and we haven't received anything, + // or else the timeout job can't write the error message to the stream. + // close() above will close it after the timeout job is run. + if (!(onTimeout != null && (!_toI2P) && totalReceived <= 0)) + out.close(); + else if (_log.shouldLog(Log.INFO)) + _log.info(direction + ": not closing so we can write the error message"); } catch (IOException ioe) { if (_log.shouldLog(Log.WARN)) _log.warn(direction + ": Error flushing to close", ioe); diff --git a/history.txt b/history.txt index b4c07dc4b5..15226641ef 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,8 @@ +2011-09-24 zzz + * HTTPClient: Fix error page not appearing, broken by + StreamForwarder change + * HTTPServer: More mime types not to compress + 2011-09-23 kytv * Update Italian, Spanish, and Swedish translations from Transifex diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index f5c9264549..43dca92409 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 = 20; + public final static long BUILD = 21; /** for example "-test" */ public final static String EXTRA = "";