tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1022293 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
Date Wed, 13 Oct 2010 21:16:35 GMT
Author: markt
Date: Wed Oct 13 21:16:33 2010
New Revision: 1022293

URL: http://svn.apache.org/viewvc?rev=1022293&view=rev
Log:
Fix reading the request line via NIO for slow clients (such as me typing via telnet). Need
to treat each section of the request line (text or space) as a separate phase.

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

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=1022293&r1=1022292&r2=1022293&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Wed Oct 13 21:16:33
2010
@@ -262,7 +262,6 @@ public class InternalNioInputBuffer exte
                 }
                 pos++;
             }
-            parsingRequestLineStart = pos;
             parsingRequestLinePhase = 3;
         }
         if ( parsingRequestLinePhase == 3 ) {
@@ -280,13 +279,17 @@ public class InternalNioInputBuffer exte
                     space = false;
                 }
             }
-
+            parsingRequestLineStart = pos;
+            parsingRequestLinePhase = 4;
+        }
+        if (parsingRequestLinePhase == 4) {
             // Mark the current buffer position
             
             int end = 0;
             //
             // Reading the URI
             //
+            boolean space = false;
             while (!space) {
                 // Read new bytes if needed
                 if (pos >= lastValid) {
@@ -316,10 +319,9 @@ public class InternalNioInputBuffer exte
             } else {
                 request.requestURI().setBytes(buf, parsingRequestLineStart, end - parsingRequestLineStart);
             }
-            parsingRequestLineStart = pos;
-            parsingRequestLinePhase = 4;
+            parsingRequestLinePhase = 5;
         }
-        if ( parsingRequestLinePhase == 4 ) {
+        if ( parsingRequestLinePhase == 5 ) {
             // Spec says single SP but also be tolerant of multiple and/or HT
             boolean space = true;
             while (space) {
@@ -334,7 +336,10 @@ public class InternalNioInputBuffer exte
                     space = false;
                 }
             }
-
+            parsingRequestLineStart = pos;
+            parsingRequestLinePhase = 6;
+        }
+        if (parsingRequestLinePhase == 6) { 
             // Mark the current buffer position
             
             end = 0;



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


Mime
View raw message