do not use Net::SSL

seems IO::Socket::SSL can now connect to proxy
This commit is contained in:
Dietmar Maurer
2016-02-26 11:29:00 +01:00
parent 7fc52dff20
commit f494187fb6
3 changed files with 2 additions and 24 deletions

View File

@ -457,14 +457,8 @@ __PACKAGE__->register_method({
$ua->max_size(1024*1024);
$ua->ssl_opts(verify_hostname => 0); # don't care for changelogs
# HACK: LWP does not use proxy 'CONNECT' for https
local $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";
local ($ENV{HTTPS_PROXY}, $ENV{HTTPS_PROXY_USERNAME}, $ENV{HTTPS_PROXY_PASSWORD});
if ($proxy) {
($ENV{HTTPS_PROXY}, $ENV{HTTPS_PROXY_USERNAME}, $ENV{HTTPS_PROXY_PASSWORD}) =
PVE::API2Tools::parse_http_proxy($proxy);
$ua->proxy(['http'], $proxy);
$ua->proxy(['http', 'https'], $proxy);
} else {
$ua->env_proxy;
}

View File

@ -4,7 +4,6 @@ use strict;
use warnings;
use Digest::MD5 qw(md5_hex md5_base64);
use MIME::Base64;
use Net::SSL;
use HTTP::Request;
use LWP::UserAgent;
use JSON;
@ -225,18 +224,9 @@ sub check_subscription {
$req->content($content);
my $ua = LWP::UserAgent->new(protocols_allowed => ['https'], timeout => 30);
$ua->ssl_opts(verify_hostname => 0); # don't care
# HACK: LWP does not use proxy 'CONNECT' for https
local $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";
local ($ENV{HTTPS_PROXY}, $ENV{HTTPS_PROXY_USERNAME}, $ENV{HTTPS_PROXY_PASSWORD});
if ($proxy) {
# some proxies reject connection if UserAgent header is not set
Net::SSL::send_useragent_to_proxy(1);
($ENV{HTTPS_PROXY}, $ENV{HTTPS_PROXY_USERNAME}, $ENV{HTTPS_PROXY_PASSWORD}) =
PVE::API2Tools::parse_http_proxy($proxy);
$ua->proxy(['http'], $proxy);
$ua->proxy(['https'], $proxy);
} else {
$ua->env_proxy;
}

View File

@ -263,12 +263,6 @@ sub update {
import_gpg_keys();
# ensure that always use the same socket class
local $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "IO::Socket::SSL";
# this code works for ftp and http
# always use passive ftp
local $ENV{FTP_PASSIVE} = 1;
my $ua = LWP::UserAgent->new;
$ua->agent("PVE/1.0");