Bug #1013: Handling of [ and ] in URIs
http://redmine.ruby-lang.org/issues/show/1013

Author: Tobias Gruetzmacher
Status: Open, Priority: Normal
Reproducible Version: 1.8.7-p72

This is a little bit related to the old Tracker entry http://rubyforge.org/tracker/?group_id=426&atid=1698&func=detail&aid=1952

The problem surfaced for me again just today, while working with WWW::Mechanize parsing a private website (sorry, no public test case) using some Drupal image gallery software. It produces URIs like http://localhost/images/file[1].jpg without escaping the [ and ].

I know this is against the RFC (RFC 3986 states in section 3.2.2. Host: "This is the only place where square bracket characters are allowed in the URI syntax."), but I would be glad if Ruby was a little bit more liberal (in the old spirit of "Be liberal with what you accept and strict with what you produce") and accept these malformed URIs. Bonus points if it also corrected them...

I had posted a "fix" to the old tracker item, but while it is a working workaround, it doesn't look like a valid solution to me anymore.

This bug also applies to Ruby 1.9.


----------------------------------------
http://redmine.ruby-lang.org