develooper Front page | perl.libwww | Postings from December 2000

a bug in HTTP::Response::base?

Thread Next
From:
Richard Chen
Date:
December 16, 2000 04:44
Subject:
a bug in HTTP::Response::base?
Message ID:
20001216074453.I29656@dell.homeland.com
Hi,

The default install of apache uses index.html.en.
So if you request for http://localhost/, the server
hands out index.html.en.

If you use lwp against such as a server, the
base method gives nothing but index.html.en,
which is wrong:

$ cat foo.pl
#!/usr/bin/perl
use LWP::UserAgent;
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request 'GET',"http://localhost/";
my $res = $ua->request($req);
if ($res->is_success) {
        my $base=$res->base;
        print "base url is =",$base->url,"\n";
        print "Content-Location=",$res->header('Content-Location'),"\n";
} else {
        print "Error: " . $res->code . "\n";
}

$ foo.pl
base url is =index.html.en
Content-Location=index.html.en

The source of the problem is because Content-Location uses
relative url.

Is this a known bug or feature?

Thanks

Richard

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About