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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/plain
Charset: utf8
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 459
Download (untitled) / with headers
text/plain 459b
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$
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-2295-1255416469-1717.46630-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 171
Download (untitled) / with headers
text/plain 171b
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.
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-2295-1255416469-1717.46630-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <rt-3.6.HEAD-2295-1255416469-1717.46630-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-2295-1255417974-898.46630-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 377
Download (untitled) / with headers
text/plain 377b
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/
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-2295-1255417974-898.46630-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <rt-3.6.HEAD-2295-1255416469-1717.46630-0-0 [...] rt.cpan.org> <rt-3.6.HEAD-2295-1255417974-898.46630-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-2295-1255426621-1096.46630-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 615
Download (untitled) / with headers
text/plain 615b
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;'
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-2295-1255426621-1096.46630-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <rt-3.6.HEAD-2295-1255416469-1717.46630-0-0 [...] rt.cpan.org> <rt-3.6.HEAD-2295-1255417974-898.46630-0-0 [...] rt.cpan.org> <rt-3.6.HEAD-2295-1255426621-1096.46630-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-2295-1255426964-165.46630-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 722
Download (untitled) / with headers
text/plain 722b
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.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.