Return-Path: Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: (qmail 65244 invoked from network); 13 Oct 2010 21:17:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Oct 2010 21:17:36 -0000 Received: (qmail 27904 invoked by uid 500); 13 Oct 2010 21:17:35 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 27844 invoked by uid 500); 13 Oct 2010 21:17:35 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 27835 invoked by uid 99); 13 Oct 2010 21:17:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Oct 2010 21:17:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Oct 2010 21:17:33 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3A3D623889BB; Wed, 13 Oct 2010 21:16:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1022293 - /tomcat/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java Date: Wed, 13 Oct 2010 21:16:35 -0000 To: dev@tomcat.apache.org From: markt@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101013211636.3A3D623889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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