【问题标题】:Net::XMPP Perl module:ssl path error on windows systemNet::XMPP Perl 模块:Windows 系统上的 ssl 路径错误
【发布时间】:2019-09-24 23:43:26
【问题描述】:

我尝试在运行 Strawberry Perl 的 Windows 10 机器上使用 perl 模块 Net::XMPP 连接到 XMPP 服务器,但出现以下错误:

Invalid or unreadable path specified for ssl_ca_path. at C:/strawberry/perl/site/lib/XML/Stream.pm line 640

我使用的代码如下:

#!/bin/perl -w

use strict;
use warnings;

use Net::XMPP;

my $con = new Net::XMPP::Client(); 

my $status = $con->Connect(  
    hostname => 'hostnamepart',  
    connectiontype => 'tcpip',  
    tls => 1);  
die('ERROR: XMPP connection failed') if ! defined($status);

我已经测试了我是否可以在我的 Windows 机器上使用 Pidgin 客户端应用程序连接到服务器并且它工作正常。

有什么办法可以解决我的 Perl 问题吗?

【问题讨论】:

    标签: windows perl xmpp


    【解决方案1】:

    从源代码中我可以看出,ssl_ca_path 必须在使用 ssl => 1tls => 1 时提供。 (可以是文件或目录。)

    例如,相信您可以使用类似以下的方法来信任 Mozilla 信任的 CA。

    use Mozilla::CA       qw( );
    use Net::XMPP::Client qw( );
    
    my $con = Net::XMPP::Client->new();
    
    $con->Connect(  
        ...
        tls         => 1,
        ssl_ca_path => Mozilla::CA::SSL_ca_file(),
    );  
    

    【讨论】:

    • 感谢您的快速回复...不幸的是,这并不能解决我的问题,我现在收到错误“错误:XMPP 连接在 perlprog.pl 第 23 行失败”
    • 嗯,它确实解决了你问的问题。看来你还有一个。错误消息似乎在 $con->GetErrorCode() 中。 (糟糕的文档!!!)
    猜你喜欢
    • 2013-07-16
    • 2016-03-27
    • 1970-01-01
    • 2020-11-05
    • 2016-08-10
    • 2020-03-10
    • 2017-10-18
    • 2019-12-22
    • 1970-01-01
    相关资源
    最近更新 更多