https://issues.apache.org/bugzilla/show_bug.cgi?id=57215

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
This is going to get messy.

The Javadoc for HttpServletRequest.getContextPath() says the container should
not decode the returned value.

Where this gets 'interesting' is when the URI is not normalized and is encoded.
For example, what gets returned for a request to "%2Ffoo%2F%2E%2E%2Fpath"?

Is it:
"%2Fpath" ?
"%2Ffoo%2F%2E%2E%2Fpath" ?

Something else?

We know (from the mapper) how many '/' characters to include in the context
path. The current approach of simply searching that many '/' characters down
the request URI ignores issues of normalization and encoding. Doing that
counting in a normalization and encoding aware manner is probably the answer
but that is non-trivial to say the least.

Fixing this bug might not solve the problem you are seeing - particularly since
the unit tests you provided are using the incorrect value for the expected
context path. You should probably be using ServletContext.getContextPath().

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to