【发布时间】:2014-04-23 19:35:45
【问题描述】:
我正在尝试通过 HTTPS 连接到使用 LWP::Simple 的站点。我已经在脚本内部和 shell 中设置了环境变量。我继续收到 500 连接超时。我可以很好地连接到 HTTP 站点。
代理允许通信通过。我可以毫无问题地使用 curl 通过代理连接到 HTTPS 站点。
有什么建议吗?
#!/usr/bin/perl
use warnings;
use Net::SSL;
use LWP::UserAgent;
use LWP::Debug qw(+);
use Data::Dumper;
$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";
$ENV{HTTPS_DEBUG} = 1;
$ENV{HTTPS_VERSION} = 2;
my $ua = LWP::UserAgent->new (verify_hostname => 0);
$ua->ssl_opts(verify_hostname => 0,
SSL_verify_mode => 0x00);
$ua->proxy('https' => 'http://x.x.x.x:3128');
print $ua->proxy('https');
print Dumper($ua);
my $response = $ua->get('https://qualys.com/');
print Dumper ($response);
if ($response->is_success) {
print $response->decoded_content; # or whatever
exit(0);
}
else {
print "\nFail:\n";
print $response->status_line ."\n";
exit(1);
}
【问题讨论】: