Skip Menu |
 

This queue is for tickets about the URI CPAN distribution.

Report information
The Basics
Id: 41292
Status: new
Priority: 0/
Queue: URI

People
Owner: Nobody in particular
Requestors: wdhawes [...] gmail.com (daily)
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.37
Fixed in: (no value)



Subject: Stringified URI::URL does not include port number
Download (untitled) / with headers
text/plain 695b
If you call URI::URL->new() using a URL with a standard port number for the protocol in question (e.g. 'http://some.host:80' or 'rtsp://some.host:554'), the port number is returned by ->port(), but is omitted when the object is stringified: my $uri = URI::URL->new('http://some.host:80'); print $uri->port; # 80 print $uri; # 'http://some.host/' If you then explicitly set the port to the same value, it does get included: $uri->port(80); print $uri->port; # 80 print $uri; # 'http://some.host:80/' The issue is not present when using a non-standard port in the URL passed to the constructor: print URI::URL->new('http://some.host:81'); # 'http://some.host:81/' A failing test is attached.
Subject: uri_test.pl
Download uri_test.pl
text/x-perl 433b
#!perl use strict; use warnings; use Test::More tests => 3; use URI::URL; my $str = 'rtsp://some.host:554'; my $uri = URI::URL->new($str); is($uri->port, 554, 'URL::URL has correct port number'); like($uri, qr/:554/, 'stringified URI::URL includes port number'); # explicitly setting the same port number makes the test pass $uri->port(554); like($uri, qr/:554/, 'stringified URI::URL includes port number');


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.