Author: markt Date: Wed Mar 6 20:45:28 2013 New Revision: 1453544 URL: http://svn.apache.org/r1453544 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54624 Read request body before content length header is restored for the old request as AJP connector uses this to determine how many bytes to read (and it will block until they are read)
Modified: tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java Modified: tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java?rev=1453544&r1=1453543&r2=1453544&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java (original) +++ tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java Wed Mar 6 20:45:28 2013 @@ -515,6 +515,16 @@ public class FormAuthenticator return false; } + // Swallow any request body since we will be replacing it + // Need to do this before headers are restored as AJP connector uses + // content length header to determine how much data needs to be read for + // request body + byte[] buffer = new byte[4096]; + InputStream is = request.createInputStream(); + while (is.read(buffer) >= 0) { + // Ignore request body + } + // Modify our current request to reflect the original one request.clearCookies(); Iterator<Cookie> cookies = saved.getCookies(); @@ -552,13 +562,6 @@ public class FormAuthenticator request.getCoyoteRequest().getParameters().setQueryStringEncoding( request.getConnector().getURIEncoding()); - // Swallow any request body since we will be replacing it - byte[] buffer = new byte[4096]; - InputStream is = request.createInputStream(); - while (is.read(buffer) >= 0) { - // Ignore request body - } - ByteChunk body = saved.getBody(); if (body != null) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org