You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by abdurrahman sahin <ab...@argela.com.tr> on 2006/02/01 10:10:34 UTC

percent sign in URI

I realized apache2 web server properyl handles % sign in URIs, i need =
exact functionality on tomcat 5 too.
When I try to pass a parameter containing % sign, the parameter value on =
the server seems null.
like
http://localhost:8080/aSite/aPage?query=hi%everybody
Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.

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


RE: percent sign in URI

Posted by abdurrahman sahin <ab...@argela.com.tr>.
hi;
my friend tried it, reported that it didn't work.


abdurrahman


-----Original Message-----
From: Aurélien DEHAY [mailto:ad@zorel.org]
Sent: Wednesday, February 01, 2006 11:29 AM
To: Tomcat Users List
Subject: Re: percent sign in URI


Hello.

abdurrahman sahin wrote:
> I realized apache2 web server properyl handles % sign in URIs, i need =
> exact functionality on tomcat 5 too.
> When I try to pass a parameter containing % sign, the parameter value on =
> the server seems null.
> like
> http://localhost:8080/aSite/aPage?query=hi%everybody
> Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.

What happens if you set  URIEncoding="UTF-8" to your connector in
server.xml file?

--
Aurélien

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



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


Re: percent sign in URI

Posted by Aurélien DEHAY <ad...@zorel.org>.
Hello.

abdurrahman sahin wrote:
> I realized apache2 web server properyl handles % sign in URIs, i need =
> exact functionality on tomcat 5 too.
> When I try to pass a parameter containing % sign, the parameter value on =
> the server seems null.
> like
> http://localhost:8080/aSite/aPage?query=hi%everybody
> Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.

What happens if you set  URIEncoding="UTF-8" to your connector in 
server.xml file?

-- 
Aurélien

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


Re: percent sign in URI

Posted by "Seak, Teng-Fong" <se...@yahoo.com>.
    I'm not sure "properly" is the correct word to use in your 
situation.  Doing things based on bug is always a big risk.  If one day 
Apache corrects this bug, your customer will have a great pain in the *ss!

abdurrahman sahin wrote:

>hi David;
>I am aware of the case. As I stated before Apache2 server properly handles
>that problem and I need that functionality because our customer's system
>built on it.
>
>
>-----Original Message-----
>From: David Delbecq [mailto:david.delbecq@oma.be]
>Sent: Wednesday, February 01, 2006 11:58 AM
>To: Tomcat Users List
>Subject: Re: percent sign in URI
>
>
>Hello abdurrahman,
>
>Your url is incorrect, replace it with
>http://localhost:8080/aSite/aPage?query=hi%25everybody
>
>According to rfc 1738, 2.2. URL Character Encoding Issues
>
>   Octets must be encoded ..., if the use of the corresponding character is
>unsafe, ...
>   The character "%" is unsafe because it is used for encodings of other
>characters.
>   Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
>reserved characters used for their reserved purposes may be used unencoded
>within a URL.
>
>There is no details in RFC on how to handle badly shaped urls (like % not
>followed by 2 hex digits) and thus your urls should not rely upon this.
>
>Regards.
>
>abdurrahman sahin a écrit :
>
>  
>
>>I realized apache2 web server properyl handles % sign in URIs, i need =
>>exact functionality on tomcat 5 too.
>>When I try to pass a parameter containing % sign, the parameter value on =
>>the server seems null.
>>like
>>http://localhost:8080/aSite/aPage?query=hi%everybody
>>Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>    
>>


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


RE: percent sign in URI

Posted by abdurrahman sahin <ab...@argela.com.tr>.
hi David;
I think I'll try your 2nd solution offer.
thank you for your help.


-----Original Message-----
From: David Delbecq [mailto:delbd@oma.be]
Sent: Wednesday, February 01, 2006 1:16 PM
To: Tomcat Users List
Subject: Re: percent sign in URI


How does your customer system handle this?

http://localhost:8080/aSite/aPage?query=I%fear%dead%results

badly, obviously :)

Possible solutions:
1) You can still try in servlet 'aPage' to grab the request using
request.getQueryString() which should returns you "query=hi%everybody"
2) You can write a servlet filter for /* which will create a new
HttpServletRequest Object with parameters you parse in your way from the
getQueryString() above
3) You can open tomcat source, patch the url decoder, and use it

What ever solution is choosen, customer will be bound to a side effect
of error handling in server.

abdurrahman sahin a écrit :

>hi David;
>I am aware of the case. As I stated before Apache2 server properly handles
>that problem and I need that functionality because our customer's system
>built on it.
>
>
>-----Original Message-----
>From: David Delbecq [mailto:david.delbecq@oma.be]
>Sent: Wednesday, February 01, 2006 11:58 AM
>To: Tomcat Users List
>Subject: Re: percent sign in URI
>
>
>Hello abdurrahman,
>
>Your url is incorrect, replace it with
>http://localhost:8080/aSite/aPage?query=hi%25everybody
>
>According to rfc 1738, 2.2. URL Character Encoding Issues
>
>   Octets must be encoded ..., if the use of the corresponding character is
>unsafe, ...
>   The character "%" is unsafe because it is used for encodings of other
>characters.
>   Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
>reserved characters used for their reserved purposes may be used unencoded
>within a URL.
>
>There is no details in RFC on how to handle badly shaped urls (like % not
>followed by 2 hex digits) and thus your urls should not rely upon this.
>
>Regards.
>
>abdurrahman sahin a écrit :
>
>
>
>>I realized apache2 web server properyl handles % sign in URIs, i need =
>>exact functionality on tomcat 5 too.
>>When I try to pass a parameter containing % sign, the parameter value on =
>>the server seems null.
>>like
>>http://localhost:8080/aSite/aPage?query=hi%everybody
>>Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>


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



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


Re: percent sign in URI

Posted by David Delbecq <de...@oma.be>.
How does your customer system handle this?

http://localhost:8080/aSite/aPage?query=I%fear%dead%results

badly, obviously :)

Possible solutions:
1) You can still try in servlet 'aPage' to grab the request using
request.getQueryString() which should returns you "query=hi%everybody"
2) You can write a servlet filter for /* which will create a new
HttpServletRequest Object with parameters you parse in your way from the
getQueryString() above
3) You can open tomcat source, patch the url decoder, and use it

What ever solution is choosen, customer will be bound to a side effect
of error handling in server.

abdurrahman sahin a écrit :

>hi David;
>I am aware of the case. As I stated before Apache2 server properly handles
>that problem and I need that functionality because our customer's system
>built on it.
>
>
>-----Original Message-----
>From: David Delbecq [mailto:david.delbecq@oma.be]
>Sent: Wednesday, February 01, 2006 11:58 AM
>To: Tomcat Users List
>Subject: Re: percent sign in URI
>
>
>Hello abdurrahman,
>
>Your url is incorrect, replace it with
>http://localhost:8080/aSite/aPage?query=hi%25everybody
>
>According to rfc 1738, 2.2. URL Character Encoding Issues
>
>   Octets must be encoded ..., if the use of the corresponding character is
>unsafe, ...
>   The character "%" is unsafe because it is used for encodings of other
>characters.
>   Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
>reserved characters used for their reserved purposes may be used unencoded
>within a URL.
>
>There is no details in RFC on how to handle badly shaped urls (like % not
>followed by 2 hex digits) and thus your urls should not rely upon this.
>
>Regards.
>
>abdurrahman sahin a écrit :
>
>  
>
>>I realized apache2 web server properyl handles % sign in URIs, i need =
>>exact functionality on tomcat 5 too.
>>When I try to pass a parameter containing % sign, the parameter value on =
>>the server seems null.
>>like
>>http://localhost:8080/aSite/aPage?query=hi%everybody
>>Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>  
>


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


RE: percent sign in URI

Posted by abdurrahman sahin <ab...@argela.com.tr>.
hi David;
I am aware of the case. As I stated before Apache2 server properly handles
that problem and I need that functionality because our customer's system
built on it.


-----Original Message-----
From: David Delbecq [mailto:david.delbecq@oma.be]
Sent: Wednesday, February 01, 2006 11:58 AM
To: Tomcat Users List
Subject: Re: percent sign in URI


Hello abdurrahman,

Your url is incorrect, replace it with
http://localhost:8080/aSite/aPage?query=hi%25everybody

According to rfc 1738, 2.2. URL Character Encoding Issues

   Octets must be encoded ..., if the use of the corresponding character is
unsafe, ...
   The character "%" is unsafe because it is used for encodings of other
characters.
   Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
reserved characters used for their reserved purposes may be used unencoded
within a URL.

There is no details in RFC on how to handle badly shaped urls (like % not
followed by 2 hex digits) and thus your urls should not rely upon this.

Regards.

abdurrahman sahin a écrit :

>I realized apache2 web server properyl handles % sign in URIs, i need =
>exact functionality on tomcat 5 too.
>When I try to pass a parameter containing % sign, the parameter value on =
>the server seems null.
>like
>http://localhost:8080/aSite/aPage?query=hi%everybody
>Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>

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



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


Re: percent sign in URI

Posted by David Delbecq <da...@oma.be>.
Hello abdurrahman,

Your url is incorrect, replace it with
http://localhost:8080/aSite/aPage?query=hi%25everybody

According to rfc 1738, 2.2. URL Character Encoding Issues
   
   Octets must be encoded ..., if the use of the corresponding character is unsafe, ...
   The character "%" is unsafe because it is used for encodings of other characters.
   Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL.

There is no details in RFC on how to handle badly shaped urls (like % not followed by 2 hex digits) and thus your urls should not rely upon this.

Regards.

abdurrahman sahin a écrit :

>I realized apache2 web server properyl handles % sign in URIs, i need =
>exact functionality on tomcat 5 too.
>When I try to pass a parameter containing % sign, the parameter value on =
>the server seems null.
>like
>http://localhost:8080/aSite/aPage?query=hi%everybody
>Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>  
>

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


Re: percent sign in URI

Posted by Tim Funk <fu...@joedog.org>.
If this were fixed, there would be a host of people complaining about the 
opposite. The URL below is inavlid based ont the RFC. getParameter has some 
basic assumptions that the url is correctly encoded.

If you wish to place bad data in the query string, I recommend using 
request.getQueryString() and parse it yourself.

-Tim

abdurrahman sahin wrote:
> I realized apache2 web server properyl handles % sign in URIs, i need =
> exact functionality on tomcat 5 too.
> When I try to pass a parameter containing % sign, the parameter value on =
> the server seems null.
> like
> http://localhost:8080/aSite/aPage?query=hi%everybody
> Tomcat 5 cannot handle that, Is there a way to do it with tomcat 5.
> 

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