ASF Bugzilla – Attachment 29222 Details for
Bug 48692
Provide option to parse application/x-www-form-urlencoded PUT requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for Tomcat 6.0
48692.diff (text/plain), 7.16 KB, created by
Christopher Schultz
on 2012-08-14 00:54:10 UTC
(
hide
)
Description:
Patch for Tomcat 6.0
Filename:
MIME Type:
Creator:
Christopher Schultz
Created:
2012-08-14 00:54:10 UTC
Size:
7.16 KB
patch
obsolete
> >Property changes on: . >___________________________________________________________________ >Modified: svn:mergeinfo > Merged /tomcat/trunk:r1041892,1043983,1049264 > >Index: java/org/apache/catalina/connector/LocalStrings.properties >=================================================================== >--- java/org/apache/catalina/connector/LocalStrings.properties (revision 1372499) >+++ java/org/apache/catalina/connector/LocalStrings.properties (working copy) >@@ -30,6 +30,7 @@ > coyoteConnector.protocolHandlerResumeFailed=Protocol handler resume failed > coyoteConnector.MapperRegistration=register Mapper: {0} > coyoteConnector.protocolUnregistrationFailed=Protocol handler stop failed >+coyoteConnector.parseBodyMethodNoTrace=TRACE method MUST NOT include an entity (see RFC 2616 Section 9.6) > > # > # CoyoteAdapter >Index: java/org/apache/catalina/connector/Request.java >=================================================================== >--- java/org/apache/catalina/connector/Request.java (revision 1372499) >+++ java/org/apache/catalina/connector/Request.java (working copy) >@@ -2596,7 +2596,7 @@ > if (usingInputStream || usingReader) > return; > >- if (!getMethod().equalsIgnoreCase("POST")) >+ if( !getConnector().isParseBodyMethod(getMethod()) ) > return; > > String contentType = getContentType(); >Index: java/org/apache/catalina/connector/Connector.java >=================================================================== >--- java/org/apache/catalina/connector/Connector.java (revision 1372499) >+++ java/org/apache/catalina/connector/Connector.java (working copy) >@@ -18,7 +18,10 @@ > > package org.apache.catalina.connector; > >+import java.util.Arrays; > import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Set; > > import javax.management.MBeanRegistration; > import javax.management.MBeanServer; >@@ -44,7 +47,7 @@ > > > /** >- * Implementation of a Coyote connector for Tomcat 5.x. >+ * Implementation of a Coyote connector. > * > * @author Craig R. McClanahan > * @author Remy Maucherat >@@ -211,8 +214,19 @@ > */ > protected int maxSavePostSize = 4 * 1024; > >+ /** >+ * Comma-separated list of HTTP methods that will be parsed according >+ * to POST-style rules for application/x-www-form-urlencoded request bodies. >+ */ >+ protected String parseBodyMethods = "POST"; > > /** >+ * A Set of methods determined by {@link #parseBodyMethods}. >+ */ >+ protected Set<String> parseBodyMethodsSet; >+ >+ >+ /** > * Has this component been initialized yet? > */ > protected boolean initialized = false; >@@ -617,6 +631,33 @@ > } > > >+ public String getParseBodyMethods() { >+ >+ return this.parseBodyMethods; >+ >+ } >+ >+ public void setParseBodyMethods(String methods) { >+ >+ HashSet<String> methodSet = new HashSet<String>(); >+ >+ if( null != methods ) >+ methodSet.addAll(Arrays.asList(methods.split("\\s*,\\s*"))); >+ >+ if( methodSet.contains("TRACE") ) >+ throw new IllegalArgumentException(sm.getString("coyoteConnector.parseBodyMethodNoTrace")); >+ >+ this.parseBodyMethods = methods; >+ this.parseBodyMethodsSet = methodSet; >+ >+ } >+ >+ protected boolean isParseBodyMethod(String method) { >+ >+ return parseBodyMethodsSet.contains(method); >+ >+ } >+ > /** > * Return the port number on which we listen for requests. > */ >@@ -1071,6 +1112,10 @@ > adapter = new CoyoteAdapter(this); > protocolHandler.setAdapter(adapter); > >+ // Make sure parseBodyMethodsSet has a default >+ if( null == parseBodyMethodsSet ) >+ setParseBodyMethods(getParseBodyMethods()); >+ > IntrospectionUtils.setProperty(protocolHandler, "jkHome", > System.getProperty("catalina.base")); > >Index: webapps/docs/changelog.xml >=================================================================== >--- webapps/docs/changelog.xml (revision 1372499) >+++ webapps/docs/changelog.xml (working copy) >@@ -46,6 +46,10 @@ > <section name="Tomcat 6.0.36 (jfclere)" rtext=""> > <subsection name="Catalina"> > <changelog> >+ <update> >+ <bug>48692</bug>: Provide option to parse >+ <code>application/x-www-form-urlencoded</code> PUT requests. (schultz) >+ </update> > <add> > <bug>50306</bug>: New StuckThreadDetectionValve to detect requests that > take a long time to process, which might indicate that their processing >Index: webapps/docs/config/ajp.xml >=================================================================== >--- webapps/docs/config/ajp.xml (revision 1372499) >+++ webapps/docs/config/ajp.xml (working copy) >@@ -130,6 +130,26 @@ > to 4096 (4 kilobytes).</p> > </attribute> > >+ <attribute name="parseBodyMethods" required="false"> >+ <p>A comma-separated list of HTTP methods for which request >+ bodies will be parsed for request parameters identically >+ to POST. This is useful in RESTful applications that want to >+ support POST-style semantics for PUT requests. >+ Note that any setting other than <code>POST</code> causes Tomcat >+ to behave in a way that does against the intent of the servlet >+ specification. >+ The HTTP method TRACE is specifically forbidden here in accordance >+ with the HTTP specification. >+ The default is <code>POST</code></p> >+ </attribute> >+ >+ <attribute name="port" required="true"> >+ <p>The TCP port number on which this <strong>Connector</strong> >+ will create a server socket and await incoming connections. Your >+ operating system will allow only one server application to listen >+ to a particular port number on a particular IP address.</p> >+ </attribute> >+ > <attribute name="protocol" required="false"> > <p>Sets the protocol to handle incoming traffic. The default value is > <code>AJP/1.3</code> and configures >Index: webapps/docs/config/http.xml >=================================================================== >--- webapps/docs/config/http.xml (revision 1372499) >+++ webapps/docs/config/http.xml (working copy) >@@ -137,6 +137,26 @@ > to 4096 (4 kilobytes).</p> > </attribute> > >+ <attribute name="parseBodyMethods" required="false"> >+ <p>A comma-separated list of HTTP methods for which request >+ bodies will be parsed for request parameters identically >+ to POST. This is useful in RESTful applications that want to >+ support POST-style semantics for PUT requests. >+ Note that any setting other than <code>POST</code> causes Tomcat >+ to behave in a way that does against the intent of the servlet >+ specification. >+ The HTTP method TRACE is specifically forbidden here in accordance >+ with the HTTP specification. >+ The default is <code>POST</code></p> >+ </attribute> >+ >+ <attribute name="port" required="true"> >+ <p>The TCP port number on which this <strong>Connector</strong> >+ will create a server socket and await incoming connections. Your >+ operating system will allow only one server application to listen >+ to a particular port number on a particular IP address.</p> >+ </attribute> >+ > <attribute name="protocol" required="false"> > <p> > Sets the protocol to handle incoming traffic.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 48692
:
26252
|
26259
| 29222