Hans de Graaff <[EMAIL PROTECTED]> writes:
> I believe I've found a bug in the base method of HTTP::Response. What
> I believe to be the correct version is this:
>
> sub base
> {
> my $self = shift;
> my $base = $self->header('Content-Base') || # HTTP/1.1
> $self->header('Content-Location') || # HTTP/1.1
> $self->header('Base') || # backwards compatability
>HTTP/1.0
> $self->request->url;
> $base = $HTTP::URI_CLASS->new($base, $self->request->url) unless ref $base;
> $base->abs($self->request->url);
> }
>
> The only change is in the last line, where I've added the abs call
> with the URL used to make the request. This fixes the problem where a
> Content-Location: header contains only a filename like 'index.html'.
> Then the URL returned will not be fully qualified.
>
> Could this go in to the next LWP release?
Yes. I simplified it until it looked like this:
sub base
{
my $self = shift;
my $base = $self->header('Content-Base') || # used to be HTTP/1.1
$self->header('Content-Location') || # HTTP/1.1
$self->header('Base'); # HTTP/1.0
return $HTTP::URI_CLASS->new_abs($base, $self->request->uri);
}
but it will then require URI-1.07 to actually work.
Regards,
Gisle