You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Willem Fibbe <wi...@realworks.nl> on 2011/11/16 12:41:41 UTC

URLDecoding not occurring for '+'

Hi,

With the HEAD revision of tc7.0.x/trunk I get that spaces are translated into + symbols.

After binary searching which SVN rev in tomcat introduced this error, I found the following:
- 1189876 correctly URL-decodes the + sign into a space
- 1189899 doesn't URL-decode the + sign into a space anymore, which results in many + characters on the server
  (and in our DB).

Looking into the SVN rev and looking into java.net.URL{Encoder,Decoder} I saw
that one case was left out in parsing parameters, so I tried the following
patch on the HEAD rev (r1202638):

Index: java/org/apache/tomcat/util/http/Parameters.java
===================================================================
--- java/org/apache/tomcat/util/http/Parameters.java    (revision 1202638)
+++ java/org/apache/tomcat/util/http/Parameters.java    (working copy)
@@ -284,6 +284,7 @@
                         pos++;
                         break;
                     case '%':
+                    case '+':
                         // Decoding required
                         if (parsingName) {
                             decodeName = true;

This solves my issue and the + signs are now correctly URL-decoded into spaces again.

I hope this patch helps.

Best regards,
Willem

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


Re: URLDecoding not occurring for '+'

Posted by Rainer Jung <ra...@kippdata.de>.
On 16.11.2011 12:41, Willem Fibbe wrote:
> Hi,
>
> With the HEAD revision of tc7.0.x/trunk I get that spaces are translated into + symbols.
>
> After binary searching which SVN rev in tomcat introduced this error, I found the following:
> - 1189876 correctly URL-decodes the + sign into a space
> - 1189899 doesn't URL-decode the + sign into a space anymore, which results in many + characters on the server
>    (and in our DB).
>
> Looking into the SVN rev and looking into java.net.URL{Encoder,Decoder} I saw
> that one case was left out in parsing parameters, so I tried the following
> patch on the HEAD rev (r1202638):
>
> Index: java/org/apache/tomcat/util/http/Parameters.java
> ===================================================================
> --- java/org/apache/tomcat/util/http/Parameters.java    (revision 1202638)
> +++ java/org/apache/tomcat/util/http/Parameters.java    (working copy)
> @@ -284,6 +284,7 @@
>                           pos++;
>                           break;
>                       case '%':
> +                    case '+':
>                           // Decoding required
>                           if (parsingName) {
>                               decodeName = true;
>
> This solves my issue and the + signs are now correctly URL-decoded into spaces again.
>
> I hope this patch helps.

Thanks for posting your observation and analyzing the problem. We just 
discovered the same 2 hours before your post while voting on 6.0.34, 
which contains a similar patch.

Regards,

Rainer


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