#!/usr/local/bin/perl -w
use LWP::UserAgent;
use LWP::Debug qw(+);
$ENV{HTTPS_PROXY} = 'http://xxx.xxx.xxx.xxx:8080';
$ENV{HTTPS_PROXY_USERNAME} = 'myUsername';
$ENV{HTTPS_PROXY_PASSWORD} = 'myPassword';
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new'GET',"https://url.name.de/");
my $res = $ua->request($req);
print $res->content;
####
LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET https://freemail.web.de/
LWP::UserAgent::_need_proxy: Not proxied
LWP::Protocol::http::request: ()
LWP::UserAgent::request: Simple response: Internal Server Error
####
For native Crypt::SSLeay proxy support of https requests,
you need to set an environment variable HTTPS_PROXY to your
proxy server & port, as in:
# PROXY SUPPORT
$ENV{HTTPS_PROXY} = 'http://proxy_hostname_or_ip:port';
$ENV{HTTPS_PROXY} = '127.0.0.1:8080';
Use of the HTTPS_PROXY environment variable in this way is
similar to LWP::UserAgent->env_proxy() usage, but calling
that method will likely override or break the Crypt::SSLeay
support, so do not mix the two.
Basic auth credentials to the proxy server can be provided
this way:
# PROXY_BASIC_AUTH
$ENV{HTTPS_PROXY_USERNAME} = 'username';
$ENV{HTTPS_PROXY_PASSWORD} = 'password';
For an example of LWP scripting with Crypt::SSLeay native
proxy support, please see the source of the ./lwp-ssl-test
script in the Crypt::SSLeay distribution.
####
my $ua = new LWP::UserAgent;
$ua->proxy([qw( https http )], "$proxy_ip:$proxy_port");
####
-----------------------------------
--the good, the bad and the physi--
-----------------------------------