Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-5093

HttpServletRequest.getRequestURI is broken for escaped char in URL since 3.1.0

    XMLWordPrintableJSON

Details

    Description

      The HttpServletRequest.getRequestURI must return the URI without processing % escaping. Since version 3.1.0 this processing is done, so the returned value is incorrect. For exemple this can lead to error in Apache Shiro when it try to unescape % of an URI.

      See the attached jar for a bundle that can be used to reproduce the problem:

      With HTTP Jetty < 3.1.0 it prints:

      Request URI: /requesturibug/test%2Ftest%25test (org.apache.felix.http.base.internal.handler.ServletHandlerRequest)
      Wrapped URI: /requesturibug/test%2Ftest%25test (org.apache.felix.http.base.internal.dispatch.FilterPipeline$FilterRequestWrapper)
      Wrapped URI: /requesturibug/test%2Ftest%25test (org.apache.felix.http.base.internal.DispatcherServlet$AttributeEventRequest)
      Wrapped URI: /requesturibug/test%2Ftest%25test (org.eclipse.jetty.server.Request)
      

      => request URI is ok

      With HTTP Jetty 3.1.0 or 3.1.2 it prints:

      Request URI: /requesturibug/test/test%test (org.apache.felix.http.base.internal.dispatch.ServletRequestWrapper)
      Wrapped URI: /requesturibug/test%2Ftest%25test (org.eclipse.jetty.server.Request)
      

      => request URI is wrong while the underlying request URI returned by Jetty itself is correct.
      When this request come the Shiro filter it will issue an exception because it will try to unescape "%te" which is not valid since "te" is not a number

      Attachments

        1. requesturibug-1.0.0-SNAPSHOT.jar
          5 kB
          Xavier Fournet
        2. requesturibug-sources.zip
          2 kB
          Xavier Fournet

        Issue Links

          Activity

            People

              cziegeler Carsten Ziegeler
              xfournet Xavier Fournet
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: