Author: fhanik
Date: Tue Jan  8 13:45:03 2008
New Revision: 610173

URL: http://svn.apache.org/viewvc?rev=610173&view=rev
Log:
fix regression for bug 11117 while maintaining the no need to proceed and block 
for comet connections that handle chunked input

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java?rev=610173&r1=610172&r2=610173&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java 
Tue Jan  8 13:45:03 2008
@@ -154,7 +154,14 @@
             chunk.setBytes(buf, pos, remaining);
             pos = pos + remaining;
             remaining = 0;
-            needCRLFParse = true;
+            //we need a CRLF
+            if ((pos+1) >= lastValid) {   
+                //if we call parseCRLF we overrun the buffer here
+                //so we defer it to the next call BZ 11117
+                needCRLFParse = true;
+            } else {
+                parseCRLF(); //parse the CRLF immediately
+            }
         }
 
         return result;
@@ -311,6 +318,7 @@
         throws IOException {
 
         boolean eol = false;
+        boolean crfound = false;
 
         while (!eol) {
 
@@ -320,7 +328,10 @@
             }
 
             if (buf[pos] == Constants.CR) {
+                if (crfound) throw new IOException("Invalid CRLF, two CR 
characters encountered.");
+                crfound = true;
             } else if (buf[pos] == Constants.LF) {
+                if (!crfound) throw new IOException("Invalid CRLF, no CR 
character encountered.");
                 eol = true;
             } else {
                 throw new IOException("Invalid CRLF");



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to