Skip Menu |

This queue is for tickets about the URI CPAN distribution.

Report information
The Basics
Id: 46630
Status: rejected
Priority: 0/
Queue: URI

People
Owner: Nobody in particular
Requestors: zzbbyy [...] gmail.com
Cc:
AdminCc:

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



Subject: No '//' between 'http:' and the authority part of the uri
If you set the schema manually - it does not add '//' between 'http:' and the authority part when printing: zby@zby:~/progs/html-formhandler$ perl -e 'use URI; $a=URI->new( "example.com" ); $a->scheme("http"); print "$a\n"' http:example.com zby@zby:~/progs/html-formhandler$ zby@zby:~/progs/html-formhandler$ perl -e 'use URI; $a=URI->new( "example.com" ); $a->scheme("http"); print $a->canonical. "\n"' http:example.com zby@zby:~/progs/html-formhandler$
URI->new("www.example.com") sets the 'path' component of the URI to the string given. A URL without a slash is a relative URL. The behaviour you see is what's expected.
On Tue Oct 13 02:47:49 2009, GAAS wrote: Show quoted text
> URI->new("www.example.com") sets the 'path' component of the URI to > the string given. A URL > without a slash is a relative URL. The behaviour you see is what's > expected.
But adding a slash there does not change the result: perl -e 'use URI; $a=URI->new("example.com/" ); $a->scheme("http"); print "$a\n"' http:example.com/
On Tue Oct 13 03:12:54 2009, ZBY wrote: Show quoted text
> On Tue Oct 13 02:47:49 2009, GAAS wrote:
> > URI->new("www.example.com") sets the 'path' component of the URI to > > the string given. A URL > > without a slash is a relative URL. The behaviour you see is what's > > expected.
> > But adding a slash there does not change the result:
Right. It's still a relative path. The slash need to go in front for it to be an absolute path, or you need 2 slashes to set the authority part. You can also try this example: perl -le 'use URI; $u = URI->new; $u->authority("example.com"); print $u; $u- Show quoted text
>scheme("http"); print $u;'
On Tue Oct 13 05:37:01 2009, GAAS wrote: Show quoted text
> On Tue Oct 13 03:12:54 2009, ZBY wrote:
> > On Tue Oct 13 02:47:49 2009, GAAS wrote:
> > > URI->new("www.example.com") sets the 'path' component of the URI
> to
> > > the string given. A URL > > > without a slash is a relative URL. The behaviour you see is
> what's
> > > expected.
> > > > But adding a slash there does not change the result:
> > Right. It's still a relative path. The slash need to go in front for > it to be an absolute path, or > you need 2 slashes to set the authority part. You can also try this > example: > > perl -le 'use URI; $u = URI->new; $u->authority("example.com"); print > $u; $u-
> >scheme("http"); print $u;'
Thanks for the explanation.