tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: Double decoding of URL
Date Mon, 07 Jul 2003 15:53:23 GMT
The current behavior seems OK.

getRequestURL() returns the URL. This method was originally in HttpUtils. It 
acts much like getRequestURI() which in the javadocs explicitly says: "The 
web container does not decode this String"

getPathInfo() OTOH according the the javadocs says... "Returns: a String, 
decoded by the web container"

-Tim

Benjamin Butler-Cole wrote:
> I am having a problem with Apache/mod_jk/Ajp13Connector/Tomcat.
> 
> If I make a request to a servlet with '%' in the path, the URL appears to be
> being decoded twice.
> 
> I have a servlet mapping of escape -> escape.jsp.  That JSP contains the
> following:
> 
>   <%= request.getPathInfo() %>
>   <%= request.getRequestURL() %>
> 
> A request to http://localhost/escape/a%25sdf returns
> 
>   /a f
>   http://sekhmet.datcon.co.uk/escape/a%sdf
> 
> And http://sekhmet/escape/a%21sdf gives
> 
>   /a!sdf
>   http://sekhmet.datcon.co.uk/escape/a!sdf
> 
> Note that getRequestURL() returns the URL *without* decoding it, while
> getPathInfo() does decode.  So it looks like the URL is already decoded
> before it reaches Tomcat (by Apache or the connector).
> 
> I would expect the values of getPathInfo() to be '/a%sdf' and '/a!sdf', and
> the values of getRequestURL to contain '%25' and '%21'.
> 
> Does anyone know what's going on?  The relevant bits of my configuration
> files are below.
> 
> Thanks
> Ben


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message