in reply to LWP::Useragent GET fails with https
If you define $ENV{HTTPS_PROXY} = 'http://proxy:8080'; you must NOT declare the proxy to LWP. So the correct code is:
#!/path/to/perl use strict; use LWP::UserAgent; use HTTP::Request::Common; use Crypt::SSLeay; $ENV{HTTPS_PROXY} = 'http://proxy:8080'; $ENV{HTTPS_DEBUG} = 1; my $myurl = "https://www.redhat.com"; my $ua = new LWP::UserAgent; $ua->cookie_jar( {} ); $ua->protocols_allowed( [ 'http','https'] ); # don't use https proxy with LWP! $ua->proxy(['http'], 'http://proxy:8080'); my $page = $ua->get($myurl); die "Error $myurl\n ", $page->status_line, "\n Aborting" unless $page->is_success; print "Success", $page->content_type, " document!\n";
Does this work for you?
Edit: corrected, removing the trailing slash from proxy url
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: LWP::Useragent GET fails with https
by Anonymous Monk on Oct 18, 2011 at 15:33 UTC | |
by wazoox (Prior) on Oct 18, 2011 at 16:49 UTC |
In Section
Seekers of Perl Wisdom