You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/12/14 10:11:52 UTC

svn commit: r1774164 - /tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java

Author: markt
Date: Wed Dec 14 10:11:52 2016
New Revision: 1774164

URL: http://svn.apache.org/viewvc?rev=1774164&view=rev
Log:
Also only modify position and limit if necessary

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java?rev=1774164&r1=1774163&r2=1774164&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11InputBuffer.java Wed Dec 14 10:11:52 2016
@@ -281,13 +281,16 @@ public class Http11InputBuffer implement
     void nextRequest() {
         request.recycle();
 
-        // Copy leftover bytes to the beginning of the buffer
-        if (byteBuffer.remaining() > 0 && byteBuffer.position() > 0) {
-            byteBuffer.compact();
-            byteBuffer.flip();
+        if (byteBuffer.position() > 0) {
+            if (byteBuffer.remaining() > 0) {
+                // Copy leftover bytes to the beginning of the buffer
+                byteBuffer.compact();
+                byteBuffer.flip();
+            } else {
+                // Reset position and limit to 0
+                byteBuffer.position(0).limit(0);
+            }
         }
-        // Always reset pos to zero
-        byteBuffer.limit(byteBuffer.limit() - byteBuffer.position()).position(0);
 
         // Recycle filters
         for (int i = 0; i <= lastActiveFilter; i++) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org