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

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

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
    Why yes it does, pure genius :D