我发现很多问题与我的问题非常相似,但他们并没有解决,所以我在这里寻求你的帮助。
我正在尝试使用https从Perl LWP网页获取数据。 我可以从几乎我尝试过的每个网站获取数据,除了我真正需要使用的网站。 我在Windows x64下使用Perl版本v5.18.2。 这是我的基本虚拟示例:
use strict;
use LWP::UserAgent;
use HTTP::Request;
use IO::Socket::SSL qw(debug3);
my $ua = LWP::UserAgent->new;
my $url = 'https://www.domainx.com:443';
my $req = HTTP::Request->new( GET => $url);
my $response = $ua->request($req);
print $response->status_line . "\n";
响应结果 - > status_line:
500 Can't connect to www.domainx.com:443
调试SSL:
DEBUG: .../IO/Socket/SSL.pm:1890: new ctx 48125200
DEBUG: .../IO/Socket/SSL.pm:393: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:395: socket connected
DEBUG: .../IO/Socket/SSL.pm:413: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:443: using SNI with hostname www.domainx.com
DEBUG: .../IO/Socket/SSL.pm:466: set socket to non-blocking to enforce timeout=180
DEBUG: .../IO/Socket/SSL.pm:479: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:489: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:499: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:519: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:479: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:1359: SSL connect attempt failed with unknown error
DEBUG: .../IO/Socket/SSL.pm:485: fatal SSL error: SSL connect attempt failed with unknown error error:14092105:SSL routines:SSL3_GET_SERVER_HELLO:wrong cipher returned
DEBUG: .../IO/Socket/SSL.pm:1924: free ctx 48125200 open=48125200
DEBUG: .../IO/Socket/SSL.pm:1932: OK free ctx 48125200
通过查看以前的帖子,我尝试申请:ssl_opts => {verify_hostname => 0},但这没有帮助。 如果我尝试使用浏览器(IE或Chrome)连接到同一个站点,它可以正常工作。
这是基于证书的错误还是这里出了什么问题?
答案 0 :(得分:1)
实际网站是www.firstcard.fi
服务器严重破坏,从report by SSLLabs也可以看到。要获得与服务器的连接,只需使用服务器提供的单个良好密码即可解决这些问题:
my $ua = LWP::UserAgent->new;
$ua->ssl_opts(SSL_cipher_list => 'DES-CBC3-SHA');
有趣的是,这个密码包含在IO :: Socket :: SSL中默认使用的密码列表中,但服务器太破碎而无法正确处理正确的ClientHello。