Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions URI/http.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ sub canonical
my $self = shift;
my $other = $self->SUPER::canonical;

my $slash_path = defined($other->authority) &&
!length($other->path) && !defined($other->query);
my $slash_path = defined($other->authority) && !length($other->path);

if ($slash_path) {
$other = $other->clone if $other == $self;
Expand Down
7 changes: 6 additions & 1 deletion t/http.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!perl -w

print "1..15\n";
print "1..16\n";

use URI;

Expand Down Expand Up @@ -61,3 +61,8 @@ $u = URI->new("http://%77%77%77%2e%70%65%72%6c%2e%63%6f%6d/%70%75%62/%61/%32%30%
print "not " unless $u->canonical eq "http://www.perl.com/pub/a/2001/08/27/bjornstad.html";
print "ok 15\n";

# RFC 1738: "/" can't be ommited when <searchpart> is present.
Copy link
Preview

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the comment: 'ommited' should be 'omitted'.

Suggested change
# RFC 1738: "/" can't be ommited when <searchpart> is present.
# RFC 1738: "/" can't be omitted when <searchpart> is present.

Copilot uses AI. Check for mistakes.

$u = URI->new("http://localhost?p=1");
print "not " unless $u->canonical eq "http://localhost/?p=1";
print "ok 16\n";