Author: markt Date: Tue May 8 17:05:00 2007 New Revision: 536382 URL: http://svn.apache.org/viewvc?view=rev&rev=536382 Log: Port fix bug 42361. Handle multi-part forms when saving request during FORM auth. Patch provided by Peter Runge.
Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/SavedRequest.java tomcat/container/tc5.5.x/webapps/docs/changelog.xml Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java?view=diff&rev=536382&r1=536381&r2=536382 ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java Tue May 8 17:05:00 2007 @@ -428,7 +428,14 @@ // Set content type MessageBytes contentType = MessageBytes.newInstance(); - contentType.setString("application/x-www-form-urlencoded"); + + // If no content type specified, use default for POST + String savedContentType = saved.getContentType(); + if (savedContentType == null) { + savedContentType = "application/x-www-form-urlencoded"; + } + + contentType.setString(savedContentType); request.getCoyoteRequest().setContentType(contentType); } } @@ -488,6 +495,7 @@ body.append(buffer, 0, bytesRead); } saved.setBody(body); + saved.setContentType(request.getContentType()); } saved.setMethod(request.getMethod()); Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/SavedRequest.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/SavedRequest.java?view=diff&rev=536382&r1=536381&r2=536382 ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/SavedRequest.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/authenticator/SavedRequest.java Tue May 8 17:05:00 2007 @@ -178,4 +178,18 @@ public void setBody(ByteChunk body) { this.body = body; } + + + /** + * The content type of the request, used if this is a POST. + */ + private String contentType = null; + + public String getContentType() { + return (this.contentType); + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } } Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?view=diff&rev=536382&r1=536381&r2=536382 ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Tue May 8 17:05:00 2007 @@ -71,6 +71,10 @@ Fix a logging related memory leak in ManagerBase and ApplicationDispatcher. (markt) </fix> + <fix> + <bug>42361</bug>: Handle multi-part forms when saving requests during + FORM authentication process. Patch provided by Peter Runge. (markt) + </fix> </changelog> </subsection> <subsection name="Webapps"> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]