* Properly expand the HTTP response header buffer (thanks shendaras!)

This commit is contained in:
jrandom
2005-03-07 00:40:45 +00:00
committed by zzz
parent 4a830e422a
commit 49d6f5018f
2 changed files with 6 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ class HTTPResponseOutputStream extends FilterOutputStream {
protected ByteArray _headerBuffer; protected ByteArray _headerBuffer;
private boolean _headerWritten; private boolean _headerWritten;
private byte _buf1[]; private byte _buf1[];
private static final int CACHE_SIZE = 4096; private static final int CACHE_SIZE = 8*1024;
public HTTPResponseOutputStream(OutputStream raw) { public HTTPResponseOutputStream(OutputStream raw) {
super(raw); super(raw);
@@ -86,7 +86,9 @@ class HTTPResponseOutputStream extends FilterOutputStream {
if (_headerBuffer.getValid() + 1 >= _headerBuffer.getData().length) { if (_headerBuffer.getValid() + 1 >= _headerBuffer.getData().length) {
int newSize = (int)(_headerBuffer.getData().length * 1.5); int newSize = (int)(_headerBuffer.getData().length * 1.5);
ByteArray newBuf = new ByteArray(new byte[newSize]); 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) if (_headerBuffer.getData().length == CACHE_SIZE)
_cache.release(_headerBuffer); _cache.release(_headerBuffer);
_headerBuffer = newBuf; _headerBuffer = newBuf;

View File

@@ -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 * 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 * Added a startRouter.sh script to new installs which simply calls
"sh i2prouter start". This should make it clear how people should start "sh i2prouter start". This should make it clear how people should start
I2P. I2P.
* Properly expand the HTTP response header buffer (thanks shendaras!)
2005-03-04 jrandom 2005-03-04 jrandom
* Filter HTTP response headers in the eepproxy, forcing Connection: close * Filter HTTP response headers in the eepproxy, forcing Connection: close