Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1436

AsyncContext.dispatch() makes servletPath, queryParameters etc urlencoded

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • 1.4.26.Final, 2.0.15.Final
    • Servlet
    • None
    • Hide

      Add a simple ServletFilter that uses ac = request.startAsync() and ac.dispatch() to a Undertow deployment
      Access undertow with a path including both path parameters and query parameters.
      Inspect request before and after calling ac.dispatch()

      Show
      Add a simple ServletFilter that uses ac = request.startAsync() and ac.dispatch() to a Undertow deployment Access undertow with a path including both path parameters and query parameters. Inspect request before and after calling ac.dispatch()

    Description

      We have a ServletFilter that uses ServletFilter.startAsync() to create a AsyncContext
      that it later do context.dispatch() on from another thread.

      We problem is that the requestPath and relativePath in the request becomes url encoded inside AsyncContextImpl.dispatch()

      The following is a represenatation of relevant parts of the HttpServletRequestImpl object before the filter runs ac = request.startAsync(); and after ac.dispatch();

      HttpServletRequestImpl ( Before startAsync(), request.getDispatcherType() == DispatcherType.REQUEST ) @13239
      characterEncoding: UTF-8
      queryParameters: (null)
      exchange (HttpServerExchange) @13244
      queryParameters:
      key: q
      value: a=a
      requestURI: /staterepository/pm_vrRequest%3ASCAR-000102
      requestPath: /staterepository/pm_vrRequest:SCAR-000102
      relativePath: /staterepository/pm_vrRequest:SCAR-000102
      queryString: q=a%3Da

      HttpServletRequestImpl ( After startAsync() and after dispatch(), request.getDispatcherType() == DispatcherType.ASYNC ) @13239
      characterEncoding: UTF-8
      queryParameters:
      key: q
      value: a%3Da
      exchange (HttpServerExchange) @13244
      queryParameters: (null)
      requestURI: /staterepository/pm_vrRequest%3ASCAR-000102
      requestPath: /staterepository/pm_vrRequest%3ASCAR-000102
      relativePath: /staterepository/pm_vrRequest%3ASCAR-000102
      queryString: q=a%3Da

      The @number is an object reference

      There is couple of differences after AsyncContextImpl.dispatch() has run
      1, requestPath and relativePath has become urlencoded
      2, queryParameters in the request object has been set and the value is urlencoded
      3, queryParameters in the exchange object has been reset to null.

      AsyncContextImpl needs to do what HttpRequestParser does, parse the path and decode it
      if UndertowOptions.DECODE_URL is set to true before it extract the different parts from the new path (that is either provided in argument to AsyncContext.dispatch(String) or AsyncContext.dispatch(ServletContext, String) or extracted from AsyncContext.dispatch()

      AsyncContext.dispatch() calls AsyncContext.dispatch(ServletContext, String path)
      where path is created from requestURI and queryString, they are both urlencoded.

      Attachments

        Issue Links

          Activity

            People

              rhn-cservice-bbaranow Bartosz Baranowski
              a030153 Anders Hanson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: