in reply to Re^2: Stateful Browsing and link extraction with AnyEvent::HTTP
in thread Async DNS with LWP
This seems to work ok? (Note the extra line!):
#!/usr/bin/perl -- use strict; use warnings; use WWW::Mechanize 1.54; my $ua = WWW::Mechanize->new; $ua->add_handler( "request_send", sub { $_[0]->content(''); $_[0]->dump; return } ); $ua->add_handler( "response_done", sub { $_[0]->content(''); $_[0]->dump; return } ); my $uri = URI->new('http://jigsaw.w3.org/HTTP/Basic/'); $ua->credentials( $uri->host_port, qw' test guest guest '); $ua->get( $uri ); print "\n--- SPECIFY HOST MANUALLY ---\n"; my $host = $uri->host( $ua->res->header('Client-peer') ); $ua->credentials( $uri->host_port, qw' test guest guest '); ### ADDED +## $ua->get( $uri, Host => $host ); __END__ GET http://jigsaw.w3.org/HTTP/Basic/ Accept-Encoding: gzip User-Agent: WWW-Mechanize/1.66
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Stateful Browsing and link extraction with AnyEvent::HTTP
by Anonymous Monk on Oct 05, 2010 at 10:31 UTC |