From 49d6f5018f6b34416445491bb176f85143a1a987 Mon Sep 17 00:00:00 2001 From: jrandom Date: Mon, 7 Mar 2005 00:40:45 +0000 Subject: [PATCH] * Properly expand the HTTP response header buffer (thanks shendaras!) --- .../src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java | 6 ++++-- history.txt | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java index 9d0af21e7..e62010206 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/HTTPResponseOutputStream.java @@ -30,7 +30,7 @@ class HTTPResponseOutputStream extends FilterOutputStream { protected ByteArray _headerBuffer; private boolean _headerWritten; private byte _buf1[]; - private static final int CACHE_SIZE = 4096; + private static final int CACHE_SIZE = 8*1024; public HTTPResponseOutputStream(OutputStream raw) { super(raw); @@ -86,7 +86,9 @@ class HTTPResponseOutputStream extends FilterOutputStream { if (_headerBuffer.getValid() + 1 >= _headerBuffer.getData().length) { int newSize = (int)(_headerBuffer.getData().length * 1.5); ByteArray newBuf = new ByteArray(new byte[newSize]); - System.arraycopy(_headerBuffer.getData(), 0, newBuf, 0, _headerBuffer.getValid()); + System.arraycopy(_headerBuffer.getData(), 0, newBuf.getData(), 0, _headerBuffer.getValid()); + newBuf.setValid(_headerBuffer.getValid()); + newBuf.setOffset(0); if (_headerBuffer.getData().length == CACHE_SIZE) _cache.release(_headerBuffer); _headerBuffer = newBuf; diff --git a/history.txt b/history.txt index 31aa298a5..db5123fa5 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,4 @@ -$Id: history.txt,v 1.164 2005/03/04 21:54:42 jrandom Exp $ +$Id: history.txt,v 1.165 2005/03/06 19:07:27 jrandom Exp $ * 2005-03-06 0.5.0.2 released @@ -10,6 +10,7 @@ $Id: history.txt,v 1.164 2005/03/04 21:54:42 jrandom Exp $ * Added a startRouter.sh script to new installs which simply calls "sh i2prouter start". This should make it clear how people should start I2P. + * Properly expand the HTTP response header buffer (thanks shendaras!) 2005-03-04 jrandom * Filter HTTP response headers in the eepproxy, forcing Connection: close