tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Donohoe <d...@donohoe.info>
Subject URL decoding of plus (aka space) isn't done
Date Tue, 13 May 2008 15:41:23 GMT

I'm tracking down a bug in Wicket that appears in Tomcat (also Jetty).  The
issue is this:

I'm submitting a URL with spaces and pluses in it.  It is URL encoded (using
java.net.URLEncoder) as follows:

http://localhost:8080/bugs/home/message/message+with+spaces+and%2Bsome%2Bpluses/

On both Tomcat and Jetty, the request.getServletPath() call returns this:

/home/message/message+with+spaces+and+some+plusses=bug/

Only the %2B (+) encodings are URL-decoded.  The + (space) encodings are
left as-is.  As you can see, through this process some information is lost
(what the original pluses were).

This happens in Tomcat in CoyoteAdapter:393:

req.getURLDecoder().convert(decodedURI, false);

The 'false' is for the "query" param, which when false, skips converting of
+

Jetty's code is similar - it just ignores '+' altogether.

My question is this.  If it is correct to URL encode spaces with +, which
doesn't Tomcat (or Jetty) decode them?  Or is the java.net.URLEncoder doing
this incorrectly?  Are + only allowed in the query string portion?   There
seems to be an impedance mismatch between what a client will allow in a URL
versus what the server is expecting.  Anyone have any insight into this? 

Thanks,

-Doug
-- 
View this message in context: http://www.nabble.com/URL-decoding-of-plus-%28aka-space%29-isn%27t-done-tp17211711p17211711.html
Sent from the Tomcat - Dev mailing list archive at Nabble.com.


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


Mime
View raw message