You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2007/03/07 19:24:44 UTC

svn commit: r515680 - /jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java

Author: olegk
Date: Wed Mar  7 10:24:44 2007
New Revision: 515680

URL: http://svn.apache.org/viewvc?view=rev&rev=515680
Log:
Fixed problem with incorrect handling of the end of stream condition

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java?view=diff&rev=515680&r1=515679&r2=515680
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/codecs/LengthDelimitedDecoder.java Wed Mar  7 10:24:44 2007
@@ -78,6 +78,10 @@
                 bytesRead = this.channel.read(dst);
             }
         }
+        if (bytesRead == -1) {
+            this.completed = true;
+            return -1;
+        }
         this.len += bytesRead;
         if (this.len >= this.contentLength) {
             this.completed = true;