From 88cfdecd38ebfcbc9d7d036f2923c8b5b16cfd6c Mon Sep 17 00:00:00 2001 From: theli Date: Tue, 24 Oct 2006 06:09:38 +0000 Subject: [PATCH] *) Bugfix: calling close must not close the wrapped input stream, otherwise keep-alive connections would terminate git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2853 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../http/httpContentLengthInputStream.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/source/de/anomic/http/httpContentLengthInputStream.java b/source/de/anomic/http/httpContentLengthInputStream.java index 317a02f92..82a333493 100644 --- a/source/de/anomic/http/httpContentLengthInputStream.java +++ b/source/de/anomic/http/httpContentLengthInputStream.java @@ -66,11 +66,20 @@ public class httpContentLengthInputStream extends httpdByteCountInputStream { return this.closed; } + /** + * Closes this input stream. + * Attention: This does not close the wrapped input stream, because + * otherwise keep-alive connections would terminate + */ public void close() throws IOException { - if (!this.closed) { - this.closed = true; - super.close(); - } + if (!this.closed) { + try { + // read to the end of the stream and throw read bytes away + httpChunkedInputStream.exhaustInputStream(this); + } finally { + this.closed = true; + } + } } public int read() throws IOException {