Skip Menu |

This queue is for tickets about the URI CPAN distribution.

Report information
The Basics
Id: 2377
Status: resolved
Priority: 0/
Queue: URI

People
Owner: Nobody in particular
Requestors: rob [...] dixon.nildram.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.23
Fixed in: (no value)



Subject: Incorrect handling ot relative URLs with no path
Distribution: URI-1.23 ActivePerl v5.6.1 build 635 Windows 98 SE Code sample and results: #!perl use URI; my $uri = new_abs URI '?query', 'http://www.domain.com/path/script.cgi'; print $uri, "\n"; __END__ output http://www.domain.com/path/?query should be http://www.domain.com/path/script.cgi?query Fix: File URI/_generic.pm lines 148 & 149 $p =~ s,[^/]+$,,; $p .= $path; to be enclosed in a conditional statement as follows if (length($path)) { $p =~ s,[^/]+$,,; $p .= $path; } Diagnosis: The preceding 'if' statement on line 141 traps the condition where both the path and the query of the relative URL are blank, and returns a result for this case immediately. Subsequent code on lines 148 & 149 assumes that the relative path is non-blank and strips the resource name from the end of the path of the base URL, replacing it with the path from the relative URL. This should happen only if the latter has a non-blank path to put in its place. Rob Dixon 10-Apr-2003 rob@dixon.nildram.co.uk
According to RFC 2396 this is not correct. It even contain this explicit example in Appendix C. C. Examples of Resolving Relative URI References Within an object with a well-defined base URI of http://a/b/c/d;p?q the relative URI would be resolved as follows: [...] ?y = http://a/b/c/?y Are MSIE or Mozilla doing it differently?
[GAAS - Wed Jul 23 00:58:51 2003]: Show quoted text
> According to RFC 2396 this is not correct. It even contain this > explicit example in Appendix C. > > C. Examples of Resolving Relative URI References > > Within an object with a well-defined base URI of > > http://a/b/c/d;p?q > > the relative URI would be resolved as follows: > > [...] > > ?y = http://a/b/c/?y > > Are MSIE or Mozilla doing it differently?
I am using this script at http://domain.com/cgi-bin/test.pl #!/usr/bin/perl use strict; use warnings; use CGI qw( :standard ); use CGI::Carp qw( fatalsToBrowser ); print header, start_html, p(a( { href => '?query' }, 'HREF="?query"' )), end_html; For which both Opera 7.10 and MSIE send the user to http://domain.com/cgi-bin/test.pl?query when the link is clicked. I cannot speak for Mozilla at present. Best regards, Rob
Seems like there is an update to RFC 2396 on it's way: http://www.apache.org/~fielding/uri/rev-2002/issues.html#003-relative-query