Skip to content

Commit 844cfd7

Browse files
committed
Fix problem where $resp->base would downcase its return value
This also reverts the parameter stripping behaviour that was introduced in d6f0844.
1 parent da7144e commit 844cfd7

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

lib/HTTP/Response.pm

+5-8
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,11 @@ sub status_line
7676
sub base
7777
{
7878
my $self = shift;
79-
my $base = $self->header('Content-Base') || # used to be HTTP/1.1
80-
$self->header('Content-Location') || # HTTP/1.1
81-
$self->header('Base'); # HTTP/1.0
82-
if ($base) {
83-
# handle multiple values (take first one), drop parameters
84-
require HTTP::Headers::Util;
85-
$base = (HTTP::Headers::Util::split_header_words($base))[0]->[0];
86-
}
79+
my $base = (
80+
$self->header('Content-Base'), # used to be HTTP/1.1
81+
$self->header('Content-Location'), # HTTP/1.1
82+
$self->header('Base'), # HTTP/1.0
83+
)[0];
8784
if ($base && $base =~ /^$URI::scheme_re:/o) {
8885
# already absolute
8986
return $HTTP::URI_CLASS->new($base);

t/base/response.t

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ for ($r->redirects) {
9494
}
9595

9696
ok($r->base, $r->request->uri);
97-
$r->push_header("Content-Location", "/1/");
98-
ok($r->base, "http://www.sn.no/1/");
97+
$r->push_header("Content-Location", "/1/A/a");
98+
ok($r->base, "http://www.sn.no/1/A/a");
9999
$r->push_header("Content-Base", "/2/;a=/foo/bar");
100-
ok($r->base, "http://www.sn.no/2/"); # parameters stripped, -Base > -Location
100+
ok($r->base, "http://www.sn.no/2/;a=/foo/bar");
101101
$r->push_header("Content-Base", "/3/");
102-
ok($r->base, "http://www.sn.no/2/"); # first one of multiple prevails
102+
ok($r->base, "http://www.sn.no/2/;a=/foo/bar");

0 commit comments

Comments
 (0)