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
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
#!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');