More lenient HTTP parameter processing
hd0815 Jul 11, 2012 3:58 AMHello,
I have the following problem:
I'm sending an invalid request to a Servlet and while processing the request parameters the AS aborts with the following exception:
java.lang.IllegalStateException: Parameters processing failed.
at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:407) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:229) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.Request.parseParameters(Request.java:2874) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.Request.getParameterNames(Request.java:1333) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.RequestFacade.getParameterNames(RequestFacade.java:379) [jbossweb-7.0.13.Final.jar:]
at foo.bar.MyServlet.doPost(MyServlet.java:80) [classes:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]
My request looks like this:
http://mysite.com/myApp?paramA=A¶mB=B&=&=¶mC=C
This only happens when using JBoss 7.1.1.Final with InternetExplorer (only checked with v9.0 of IE).
I'm not quite sure why a wrong request is sent, but I found out that sending the same request to a JBoss 7.0.2.Final doesn't cause this exception.
I started a discussion at the JBoss AS 7 board (https://community.jboss.org/message/747210).
At this discussion a work around is mentioned. Also Vaibhav N mentioned that he faces this problem in JBoss-EAP-6.0.0.
jaikiran pai told me to try asking for a configuration or parameter which allows a more lenient way of processing the HTTP parameters. A request as mentioned above shouldn't force an HTTP 500 (if the exception isn't caught) since a parameter like '&=' is not considered to be harmful. It should be possible to just ignore such parameters rather than throwing an exception.
As I already said in the other discussion:
I know that this request is wrong and I know that the application acts right, but I think in this special case an error handling is possible as it should be possible (maybe via configuration) to ignore such parameters.