Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3403

ServletController getBaseURL can not handle encoded URIs in some cases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.3, 2.4
    • 2.4, 2.3.4
    • Transports
    • None

    Description

      ServletController.getBaseURL uses HttpServletRequest.getPathInfo() to determine the base URL.

      For example, given 'http://localhost:8080/services/1' and the pathInfo equal to '/1' the base URL is 'http://localhost:8080/services'.

      The problem with using the getPathInfo in the substring calculation is that it loses matrix parameters on the last path segment, ex, given 'http://localhost:8080/services/1;a=b' which will be reported by request.getRequestURL, the getPathInfo will report "/1" only and thus the base URL will be wrong. To bypass this issue, the initial attempt was to decode request.getRequestURL and strip off the final matrix params if any and only then calculate the base path. This solution breaks with encoded %3B characters - besides it is also slow (decoding costs).

      Another problem with getPathInfo() in that given that it returns the decoded value, the problem arise on some containers with requests URIs containing double encoded '/' symbols.

      A simpler and more reliable solution is needed

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            sergey_beryozkin Sergey Beryozkin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: