Author: remy.maucherat(a)jboss.com
Date: 2008-05-26 09:49:07 -0400 (Mon, 26 May 2008)
New Revision: 639
Modified:
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
trunk/webapps/docs/changelog.xml
Log:
- Prevent pipelining with Comet and sendfile.
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-05-26 13:16:14 UTC
(rev 638)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2008-05-26 13:49:07 UTC
(rev 639)
@@ -797,11 +797,11 @@
recycle();
return SocketState.CLOSED;
} else if (!comet) {
- inputBuffer.nextRequest();
+ boolean pipelined = inputBuffer.nextRequest();
outputBuffer.nextRequest();
recycleComet();
recycle();
- return SocketState.OPEN;
+ return (pipelined) ? SocketState.CLOSED : SocketState.OPEN;
} else {
return SocketState.LONG;
}
@@ -932,16 +932,17 @@
}
request.updateCounters();
+ boolean pipelined = false;
if (!comet) {
// Next request
- inputBuffer.nextRequest();
+ pipelined = inputBuffer.nextRequest();
outputBuffer.nextRequest();
}
// Do sendfile as needed: add socket to sendfile and end
if (sendfileData != null && !error) {
sendfileData.socket = socket;
- sendfileData.keepAlive = keepAlive;
+ sendfileData.keepAlive = keepAlive && !pipelined;
if (!endpoint.getSendfile().add(sendfileData)) {
openSocket = true;
break;
Modified: trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java
===================================================================
--- trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2008-05-26 13:16:14
UTC (rev 638)
+++ trunk/java/org/apache/coyote/http11/InternalAprInputBuffer.java 2008-05-26 13:49:07
UTC (rev 639)
@@ -323,8 +323,10 @@
* Note: All bytes of the current request should have been already
* consumed. This method only resets all the pointers so that we are ready
* to parse the next HTTP request.
+ *
+ * @return true if there is data left on input (most likely a pipelined request)
*/
- public void nextRequest() {
+ public boolean nextRequest() {
// Recycle Request object
request.recycle();
@@ -354,6 +356,8 @@
swallowInput = true;
nonBlocking = false;
+ return (lastValid > 0);
+
}
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2008-05-26 13:16:14 UTC (rev 638)
+++ trunk/webapps/docs/changelog.xml 2008-05-26 13:49:07 UTC (rev 639)
@@ -29,6 +29,9 @@
<update>
Register ClusterListener in JMX. (remm)
</update>
+ <fix>
+ Improve fault recovery of ClusterListener. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -41,6 +44,10 @@
After completing an asynchronous sendfile, the socket should be placed in the
main poller
rather than assigned to a worker (where it would block). (remm)
</fix>
+ <fix>
+ Close the connection if there's an attempt to pipeline requests when using
Comet or an
+ asynchronous sendfile is needed. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">