错误:500无法连接到foo.com:443(未知errorerror:140773F2:SSL例程:SSL23_GET_SERVER_HELLO:sslv3)

时间:2015-05-26 17:48:22

标签: perl ssl lwp lwp-useragent

我正在使用LWP::UserAgent version 6.03来获取网站的状态。

   my $ua = LWP::UserAgent->new(ssl_opts => {verify_hostname => 0},);
   $ua->cookie_jar({});
   $ua->agent('Mozilla/5.0');
   push @{$ua->requests_redirectable}, 'POST';
   push @{$ua->requests_redirectable}, 'GET';

   my $url = 'https://foo.com'
   $page = $ua->get($url);
   print "Error ".$page->status_line."\n";

当我在我的unix机器上运行此代码时,它给出了以下状态和LWP模块的错误消息。

   #status
   500 Can't connect to foo.com:443

   #error
   LWP::Protocol::https::Socket: SSL connect attempt failed with unknown 
   errorerror:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert 
   unexpected message at /usr/local/lib/perl5/site_perl/5.8.9/LWP/Protocol/http.pm line 51.

我尝试使用答案given to similar question,但没有成功。需要你宝贵的建议。

运行调试

DEBUG: .../IO/Socket/SSL.pm:193: set domain to 2
DEBUG: .../IO/Socket/SSL.pm:1545: new ctx 74489552
DEBUG: .../IO/Socket/SSL.pm:334: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:336: socket connected
DEBUG: .../IO/Socket/SSL.pm:349: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:379: set socket to non-blocking to enforce timeout=180
DEBUG: .../IO/Socket/SSL.pm:392: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:402: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:412: waiting for fd to become ready: SSL wants a  read first
DEBUG: .../IO/Socket/SSL.pm:432: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:392: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:1276: SSL connect attempt failed with unknown errorerror:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message

DEBUG: .../IO/Socket/SSL.pm:398: fatal SSL error: SSL connect attempt failed with unknown errorerror:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message
DEBUG: .../IO/Socket/SSL.pm:1276: IO::Socket::INET6 configuration failederror:00000000:lib(0):func(0):reason(0)
DEBUG: .../IO/Socket/SSL.pm:1582: free ctx 74489552 open=74489552

DEBUG: .../IO/Socket/SSL.pm:1590: OK free ctx 74489552`

1 个答案:

答案 0 :(得分:1)

是的......当某些服务导致Poodle漏洞时会发生这种情况。我没有完成研究以找到确切的原因。在某些情况下,客户端和服务器似乎没有正确协商协议。我们通过将'SSL_version' => 'tlsv1'添加到" ssl_opts"来解决这个问题。我不是很喜欢它,但是因为下一次协议升级它将需要再次修复。我宁愿让图书馆自己进行谈判。