Crypt-SSLeay
view release on metacpan or search on metacpan
### `Crypt::SSLeay` proxy support
For native `Crypt::SSLeay` proxy support of https requests, you need to set the environment variable `HTTPS_PROXY` to your proxy server and 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 authentication 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 look at the `eg/lwp-ssl-test` script in the `Crypt::SSLeay` distribution.
## Client Certificate Support
Client certificates are supported. PEM encoded certificate and private key files may be used like this:
# proxy support
$ENV{HTTPS_PROXY} = 'http://proxy_hostname_or_ip:port';
$ENV{HTTPS_PROXY} = '127.0.0.1:8080';
Use of the C<HTTPS_PROXY> environment variable in this way
is similar to C<LWP::UserAgent->env_proxy()> usage, but calling
that method will likely override or break the C<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 C<Crypt::SSLeay> native proxy
support, please look at the F<eg/lwp-ssl-test> script in the
C<Crypt::SSLeay> distribution.
lib/Net/SSL.pm view on Meta::CPAN
my $peer_addr_packed = gethostbyname($peer_addr);
$self->SUPER::connect($peer_port, $peer_addr_packed)
|| croak("proxy bypass to $peer_addr:$peer_addr failed: $!");
}
my $connect_string;
if ($ENV{"HTTPS_PROXY_USERNAME"} || $ENV{"HTTPS_PROXY_PASSWORD"}) {
my $user = $ENV{"HTTPS_PROXY_USERNAME"};
my $pass = $ENV{"HTTPS_PROXY_PASSWORD"};
my $credentials = encode_base64("$user:$pass", "");
$connect_string = join($CRLF,
"CONNECT $peer_addr:$peer_port HTTP/1.0",
"Proxy-authorization: Basic $credentials"
);
}
else {
$connect_string = "CONNECT $peer_addr:$peer_port HTTP/1.0";
}
$connect_string .= $CRLF;
if (send_useragent_to_proxy()) {
my $lwp_object = $self->get_lwp_object;
if($lwp_object && $lwp_object->agent) {
( run in 0.259 second using v1.01-cache-2.11-cpan-4d50c553e7e )