Fix bug 42361. Handle multi-part forms when saving request during FORM auth. Patch...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 8 May 2007 23:58:24 +0000 (23:58 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 8 May 2007 23:58:24 +0000 (23:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@536381 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/authenticator/FormAuthenticator.java
java/org/apache/catalina/authenticator/SavedRequest.java
webapps/docs/changelog.xml

index f47673d..62bf5ee 100644 (file)
@@ -428,7 +428,14 @@ public class FormAuthenticator
     
                 // 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);
             }
         }
@@ -487,6 +494,7 @@ public class FormAuthenticator
             while ( (bytesRead = is.read(buffer) ) >= 0) {
                 body.append(buffer, 0, bytesRead);
             }
+            saved.setContentType(request.getContentType());
             saved.setBody(body);
         }
 
index 4602b4d..1eac451 100644 (file)
@@ -180,4 +180,17 @@ public final class SavedRequest {
     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;
+    }
 }
index 7a0bc22..7b6aa06 100644 (file)
   </properties>
 
 <body>
+<section name="Tomcat 6.0.14 (remm)">
+  <subsection name="Catalina">
+    <changelog>
+      <fix>
+         <bug>42361</bug>: Handle multi-part forms when saving requests during
+         FORM authentication process. Patch provided by Peter Runge. (markt)
+      </fix>
+    </changelog>
+  </subsection>
+</section>
 <section name="Tomcat 6.0.13 (remm)">
   <subsection name="Catalina">
     <changelog>