perl 500 SSL 协商失败 [英] perl 500 SSL negotiation failed

查看:26
本文介绍了perl 500 SSL 协商失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

500 SSL 协商失败.

当我尝试连接具有证书、用户名和密码作为凭据的网络服务时遇到问题,任何人都可以帮助我

代码:

$ENV{HTTPS_CA_FILE}        = '/pass/cert.crt';
$ENV{HTTPS_CA_DIR}         = '/pass/';
$ENV{HTTPS_PROXY_USERNAME} = 'username';
$ENV{HTTPS_PROXY_PASSWORD} = 'password';

use SOAP::Lite +trace => 'debug';

$soap = SOAP::Lite->new()->on_action( sub { join '/', @_ } )->proxy("`https`://`ip`:`port`/SendSMS");

sub SOAP::Transport::HTTP::Client::get_basic_credentials {
    return 'username' => 'password';
}
$som = $soap->call(
    SOAP::Data->name('SendSMSR')->attr( { xmlns => '`https`://`ip`:`port`' } ),    # *strong text*
    SOAP::Data->name('parm1')->value('1040'),
    SOAP::Data->name('param2')->value('22222'),
    SOAP::Data->name('param3')->value('1600')
);

推荐答案

SOAP::Lite 使用 LWP 来执行 HTTP(S) 请求.在版本 6(2011 年发布)中,LWP 开始使用 IO::Socket::SSL 作为后端,但直到版本 6.06 (04/2014) 才正确支持 HTTPS 代理.您使用的 HTTPS_PROXY_* 设置仅适用于旧的 Crypt::SSLeay 后端.

SOAP::Lite uses LWP to do HTTP(S) requests. With version 6 (released 2011) LWP started to use IO::Socket::SSL as the backend, but it took until version 6.06 (04/2014) to get the support for proxies for HTTPS right. The HTTPS_PROXY_* settings you use work only with the old Crypt::SSLeay backend.

请先检查您使用的 LWP::Protocol::https 版本

Please check first the version of LWP::Protocol::https you are using

perl -MLWP::Protocol::https -e 'warn $LWP::Protocol::https::VERSION'

如果它报告的版本小于 6.06,您需要升级以获得适当的 HTTPS 代理支持.除非您使用的是 Debian/Ubuntu 并且版本为 6.04.然后它可能仍然有效,因为 Debian 在 6.06 发布之前包含了必要的修复程序(Ubuntu 14.04 应该没问题).

If it reports a version smaller than 6.06 you need to upgrade to have proper HTTPS proxy support. That is unless you are on Debian/Ubuntu an have version 6.04. Then it might still work because Debian included the necessary fixes before 6.06 was released (Ubuntu 14.04 should be ok).

HTTPS_PROXY_* 将不再适用于较新的后端.从阅读 SOAP::Lite::Transport::HTTP 的代码来看,它似乎没有对 HTTPS 代理进行特殊处理,而是在设置了环境变量 HTTP_proxy 的情况下从 LWP::UserAgent 调用 env_proxy .您可以尝试设置以下环境变量来设置代理:

HTTPS_PROXY_* will no longer work with the newer backend. From reading the code of SOAP::Lite::Transport::HTTP it looks like that it does not have a special handling for HTTPS proxies, but instead just calls env_proxy from LWP::UserAgent if the environment variable HTTP_proxy is set. You might try to set the following environment variables to set the proxy:

 HTTP_proxy=whatever; # set to trigger call of env_proxy
 https_proxy=http://user:pass@your-https-proxy/

如果仍有问题,请启用调试.对于 IO::Socket::SSL,您可以通过使用

If you still have problems enable debugging. For IO::Socket::SSL you can enable debugging by calling your code with

 perl -MIO::Socket::SSL=debug4 your-program.pl

另请参阅 SOAP::Transport::HTTP,虽然没有关于如何使用 https 代理的特殊文档.

See also the documentation for SOAP::Transport::HTTP, although there is no special documentation on how to use a https proxy.

这篇关于perl 500 SSL 协商失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆