develooper Front page | perl.libwww | Postings from January 2002

Double slash in a URI: legal or not?

Thread Next
From:
Hans de Graaff
Date:
January 6, 2002 08:01
Subject:
Double slash in a URI: legal or not?
Message ID:
87ell38o55.fsf@graaff.xs4all.nl
Hi,

use URI;
my $u1 = URI->new_abs("..//file.html", "http://some.site.com/some/dir/");
print "$u1\n";

The above bit of code prints http://some.site.com/some//file.html
instead of what I would expect: http://some.site.com/some/file.html
For those of you squinting, the first one has a double slash before
file, the second one hasn't. 

RFC 2396 seems to indicate that in path segments only a single slash
is legal, so I feel that the URI class should either clean up the URI
by changing the double slash to a single slash, or it should complain
about a malformed URI. As far as I can tell nothing happens and a URI
with a double slash is returned.

In case people wonder why I care: I'm getting Checkbot bug reports of
people being bitten by this. What happens is that they get a runaway
Checkbot process checking URIs with ever more slashes in them... More
information on Checkbot is at <http://degraaff.org/checkbot/>.

Hans

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About