Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 37782 invoked from network); 19 Feb 2002 23:45:57 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 19 Feb 2002 23:45:57 -0000 Received: (qmail 24107 invoked by uid 97); 19 Feb 2002 23:46:03 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 24067 invoked by uid 97); 19 Feb 2002 23:46:02 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 17282 invoked from network); 19 Feb 2002 23:39:26 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15474.57630.693969.326604@dslsun3.dsl.ab.ca> Date: Tue, 19 Feb 2002 16:34:54 -0700 To: commons-dev@jakarta.apache.org Subject: [PATCH] HttpClient ResponseInputStream.read() detecting EOF X-Mailer: VM 7.00 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Reply-To: alvins@dsl.ab.ca From: alvins@dsl.ab.ca Errors-To: alvins@dsl.ab.ca X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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: For additional commands, e-mail: