tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kkoli...@apache.org
Subject svn commit: r1196223 - in /tomcat/trunk/java/org/apache/coyote/http11: InternalAprInputBuffer.java InternalInputBuffer.java InternalNioInputBuffer.java
Date Tue, 01 Nov 2011 19:17:39 GMT
Author: kkolinko
Date: Tue Nov  1 19:17:39 2011
New Revision: 1196223

URL: http://svn.apache.org/viewvc?rev=1196223&view=rev
Log:
Alternative implementation for r1196212 that covers all HTTP connectors.
Self-guard against unexpected call to parseHeaders() after the parsing has already been completed
without a prior call to recycle() or nextRequest().

There is already a flag variable (parsingHeader), so no need for additional state in InternalNioInputBuffer.

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
    tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java?rev=1196223&r1=1196222&r2=1196223&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java Tue Nov  1 19:17:39
2011
@@ -304,6 +304,10 @@ public class InternalAprInputBuffer exte
     @Override
     public boolean parseHeaders()
         throws IOException {
+        if (!parsingHeader) {
+            throw new IllegalStateException(
+                    sm.getString("iib.parseheaders.ise.error"));
+        }
 
         while (parseHeader()) {
             // Loop until there are no more headers

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java?rev=1196223&r1=1196222&r2=1196223&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalInputBuffer.java Tue Nov  1 19:17:39
2011
@@ -260,6 +260,10 @@ public class InternalInputBuffer extends
     @Override
     public boolean parseHeaders()
         throws IOException {
+        if (!parsingHeader) {
+            throw new IllegalStateException(
+                    sm.getString("iib.parseheaders.ise.error"));
+        }
 
         while (parseHeader()) {
             // Loop until we run out of headers

Modified: tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=1196223&r1=1196222&r2=1196223&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Tue Nov  1 19:17:39
2011
@@ -88,11 +88,7 @@ public class InternalNioInputBuffer exte
         /**
          * Reading all bytes until the next CRLF. The line is being ignored.
          */
-        HEADER_SKIPLINE,
-        /**
-         * Done parsing headers. Request body should follow.
-         */
-        HEADERS_DONE
+        HEADER_SKIPLINE
     }
 
     // ----------------------------------------------------------- Constructors
@@ -473,7 +469,7 @@ public class InternalNioInputBuffer exte
     @Override
     public boolean parseHeaders()
         throws IOException {
-        if (headerParsePos == HeaderParsePosition.HEADERS_DONE) {
+        if (!parsingHeader) {
             throw new IllegalStateException(
                     sm.getString("iib.parseheaders.ise.error"));
         }
@@ -536,7 +532,6 @@ public class InternalNioInputBuffer exte
                 // Skip
             } else if (chr == Constants.LF) {
                 pos++;
-                headerParsePos = HeaderParsePosition.HEADERS_DONE;
                 return HeaderParseStatus.DONE;
             } else {
                 break;



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


Mime
View raw message