我正在使用REST :: Client,我的代码因SSL错误而失败.
这是代码:
#!usr/bin/perl -w use strict; use REST::Client; my $client = REST::Client->new(); $client->GET("https://something/api/sessions"); print $client->responseContent();
这是输出:
WP::Protocol::https::Socket: SSL connect attempt Failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify Failed at /usr/local/share/perl/5.10.1/LWP/Protocol/http.pm line 51.
我知道这个问题. REST :: Client无法忽略SSL证书.
当我不使用“-k”选项时,我得到与curl完全相同的错误:
这是curl命令:
curl -i -H "Accept:application/*+xml;version=1.5" -u "username@system:password" -X post https://something/api/sessions
curl: (60) SSL certificate problem,verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify Failed
但是,如果我在curl命令中添加“-k”,那么它的工作正常.
从curl的手册页,这里是“-k”的解释:
(SSL) This option explicitly allows curl to perform "insecure" SSL connections and transfers.
题:
那么,我如何使REST :: Client忽略SSL证书?或者还有其他优雅的方式吗?我浏览了CPAN上的REST :: Client文档,但它没有谈论这个问题.
谢谢.