perl 500 SSL negotiation failed

孤者浪人 提交于 2019-12-12 01:57:41

问题


500 SSL negotiation failed.

have a problem when i try to connect with web service that have certification , username and password as credentials ,can any one help me

code:

$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')
);

回答1:


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.

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

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

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_* 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/

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

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



来源:https://stackoverflow.com/questions/25708141/perl-500-ssl-negotiation-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!