Ruby Forum Ruby-core > [Bug #454] URI does not follow the last rfc about uri syntax

Posted by Cyrille Faucheux (Guest)
on 19.08.2008 11:20
(Received via mailing list)
Bug #454: URI does not follow the last rfc about uri syntax
http://redmine.ruby-lang.org/issues/show/454

Author: Cyrille Faucheux
Status: Open, Priority: Normal

According to the last rcf about uri syntax 
(http://www.ietf.org/rfc/rfc3986.txt), i have found at least two "bugs" 
in the uri library.

The "#" character is a delimiter and shouldn't be escaped. In the 
current implementation, it is, so the resulting escaped uri is no more 
the good one.

Example :

>> URI.escape('http://www.example.com/the page.html#fragment')

"http://www.example.com/the%20page.html%23fragment"

As a quick patch, the "#" character must be added to the 
URI::REGEXP::RESERVED regexp.


In the same way, URI::REGEXP::UNRESERVED specify characters that are not 
marked as unreserved by the rfc.

URI : UNRESERVED = "-_.!~*'()#{ALNUM}"

RFC : unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"