develooper Front page | perl.libwww | Postings from August 2001

set Host in Header

Thread Next
From:
Angela
Date:
August 1, 2001 04:08
Subject:
set Host in Header
Message ID:
000001c11a7a$7b7b6060$9fb54dca@outblaze.com
Hi,

I am using libwww-perl-5.53_94. I want to ask how to set the host in the
header. I can do it with direct socket, but seems not work with LWP. Any
idea? Thanks a lot.

Angela.

=== LWP === not work
my $ua = new LWP::UserAgent;
my $request = new HTTP::Request('GET', 'http://host1.com/test?name=angela);
$request_login->header('Host' => host2.com');
my $response = $ua->request($request);

=== Socket === work
my $address = sockaddr_in(80, inet_aton('http://host1.com'));
with header like:
POST /test HTTP/
Referer: http://host1.com/test
Host: host2.com
...
name=angela


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