From f007137e04d24a881aa1b8159549cb3b3f4e2007 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 6 Sep 2011 15:54:51 +0000 Subject: [PATCH] More connector alignment - request header parsing git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1165728 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/coyote/http11/Http11AprProcessor.java | 9 ++++++++- java/org/apache/coyote/http11/Http11NioProcessor.java | 7 ++++--- java/org/apache/coyote/http11/Http11Processor.java | 9 ++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/java/org/apache/coyote/http11/Http11AprProcessor.java b/java/org/apache/coyote/http11/Http11AprProcessor.java index e2637f2fa..74e0ff29b 100644 --- a/java/org/apache/coyote/http11/Http11AprProcessor.java +++ b/java/org/apache/coyote/http11/Http11AprProcessor.java @@ -217,7 +217,14 @@ public class Http11AprProcessor extends AbstractHttp11Processor { } else { request.setStartTime(System.currentTimeMillis()); keptAlive = true; - inputBuffer.parseHeaders(); + // Currently only NIO will ever return false here + if (!inputBuffer.parseHeaders()) { + // We've read part of the request, don't recycle it + // instead associate it with the socket + openSocket = true; + readComplete = false; + break; + } if (!disableUploadTimeout) { Socket.timeoutSet(socketRef, connectionUploadTimeout * 1000); diff --git a/java/org/apache/coyote/http11/Http11NioProcessor.java b/java/org/apache/coyote/http11/Http11NioProcessor.java index 11b30500e..ab2748531 100644 --- a/java/org/apache/coyote/http11/Http11NioProcessor.java +++ b/java/org/apache/coyote/http11/Http11NioProcessor.java @@ -244,9 +244,10 @@ public class Http11NioProcessor extends AbstractHttp11Processor { } else { request.setStartTime(System.currentTimeMillis()); keptAlive = true; - if ( !inputBuffer.parseHeaders() ) { - //we've read part of the request, don't recycle it - //instead associate it with the socket + // Currently only NIO will ever return false here + if (!inputBuffer.parseHeaders()) { + // We've read part of the request, don't recycle it + // instead associate it with the socket openSocket = true; readComplete = false; break; diff --git a/java/org/apache/coyote/http11/Http11Processor.java b/java/org/apache/coyote/http11/Http11Processor.java index 98c60515a..3542e1d59 100644 --- a/java/org/apache/coyote/http11/Http11Processor.java +++ b/java/org/apache/coyote/http11/Http11Processor.java @@ -181,7 +181,14 @@ public class Http11Processor extends AbstractHttp11Processor { keptAlive = true; // Reset timeout for reading headers socket.getSocket().setSoTimeout(endpoint.getSoTimeout()); - inputBuffer.parseHeaders(); + // Currently only NIO will ever return false here + if (!inputBuffer.parseHeaders()) { + // We've read part of the request, don't recycle it + // instead associate it with the socket + openSocket = true; + readComplete = false; + break; + } if (!disableUploadTimeout) { socket.getSocket().setSoTimeout(connectionUploadTimeout); } -- 2.11.0