You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by al...@dsl.ab.ca on 2002/02/20 00:34:54 UTC
[PATCH] HttpClient ResponseInputStream.read() detecting EOF
Hi,
I tried sub-classing PostMethod and over-riding the readResponseBody
method. The input stream read() method does not detect the 'end of
file' condition, and eventually runs past the end of the input buffer.
a possible patch is:
--- src/java/org/apache/commons/httpclient/ResponseInputStream.java Tue Feb 19 16:28:54 2002
+++ ResponseInputStream.java Tue Feb 19 16:25:51 2002
@@ -378,6 +378,8 @@
if (buffer == null)
buffer = new byte[4096];
length = stream.read(buffer);
+ if (length == -1)
+ return false;
count += length;
} catch (Throwable t) {
t.printStackTrace();
Comments, suggestions welcome.
Alvin.
PS: I am not subscribed commons-dev@jakarta.apache.org
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>