--- connectors/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2011/08/29 19:45:42 1162959 +++ connectors/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java 2011/08/29 19:45:52 1162960 @@ -404,11 +404,13 @@ } continue; } else if(type != Constants.JK_AJP13_FORWARD_REQUEST) { - // Usually the servlet didn't read the previous request body - if(log.isDebugEnabled()) { - log.debug("Unexpected message: "+type); + // Unexpected packet type. Unread body packets should have + // been swallowed in finish(). + if (log.isDebugEnabled()) { + log.debug("Unexpected message: " + type); } - continue; + error = true; + break; } keptAlive = true; @@ -1033,6 +1035,11 @@ finished = true; + // Swallow the unread body packet if present + if (first && request.getContentLengthLong() > 0) { + receive(); + } + // Add the end message if (outputBuffer.position() + endMessageArray.length > outputBuffer.capacity()) { flush();