JAXL 异常:此流不支持 SSL/加密

Posted

技术标签:

【中文标题】JAXL 异常:此流不支持 SSL/加密【英文标题】:JAXL Exception : this stream does not support SSL/crypto 【发布时间】:2013-04-05 09:39:47 【问题描述】:

我使用 jaxl.V3 连接到 facebook。这是我的代码:

<?php

  require_once '../jaxl.php';
  $client = new JAXL(array(
     'jid' => '(myID)'.'@chat.facebook.com',
     'fb_app_key' => '(MYKeyApp)',
     'fb_access_token' => '(myAccessToken)',
     'domain'=>'chat.facebook.com',
     'host' => 'chat.facebook.com',
     'port'=>5222,
     'boshHost'=>'localhost',
     'priv_dir'  => 'D:/wamp/www/jaxl/.jaxl/tmp',
     'resource' => 'resource', 
     'force_tls' => true,
     'auth_type' => 'X-FACEBOOK-PLATFORM',
     'log_level' => JAXL_DEBUG,
    ));

    $client->add_cb('on_auth_success', function() 
        global $client;
        _info("got on_auth_success cb, jid ".$client->full_jid->to_string());
        $client->set_status("Available!", "ol", 10);
        $msg = new XMPPMsg(array('to'=>'-(myFriID)@chat.facebook.com'), $txtMessage);
            $client->send($msg);
   );


    $client->add_cb('on_auth_failure', function($reason) 
        global $client;
        $client->send_end_stream();
        _info("got on_auth_failure cb with reason $reason");

     );


     $client->add_cb('on_chat_message', function($stanza) 
        global $client;

       // echo back incoming message stanza
       $stanza->to = $stanza->from;
       $stanza->from = $client->full_jid->to_string();
       $client->send($stanza);
       _info("echo message sent");

           sendMessage($client);
   );

   $client->add_cb('on_disconnect', function() 
       _info("got on_disconnect cb");
   );

   //
   // finally start configured xmpp stream
   //
   $client->start();
   echo "done\n";
   ?>

我已成功使用控制台命令行发送消息聊天。但我需要的是浏览器。相同的代码配置,如果我通过浏览器运行它,我会在日志文件中收到消息错误,例如:

jaxl_fsm:56 - 2013-04-05 23:00:57 - calling state handler 'setup' for incoming event   'connect'
jaxl_socket_client:91 - 2013-04-05 23:00:57 - trying tcp://chat.facebook.com:5222
jaxl_socket_client:96 - 2013-04-05 23:00:57 - connected to tcp://chat.facebook.com:5222
jaxl_loop:82 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 0
jaxl_fsm:65 - 2013-04-05 23:00:57 - current state 'connected'
jaxl_fsm:56 - 2013-04-05 23:00:57 - calling state handler 'connected' for incoming event 'start_stream'
jaxl_loop:82 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 1
jaxl_fsm:65 - 2013-04-05 23:00:57 - current state 'wait_for_stream_start'
jaxl_socket_client:187 - 2013-04-05 23:00:57 - sent 226/226 of data
jaxl_socket_client:188 - 2013-04-05 23:00:57 - <stream:stream    xmlns:stream="http://etherx.jabber.org/streams" version="1.0" from="100004083275041@chat.facebook.com" to="chat.facebook.com" xmlns="jabber:client"  xml:lang="en" xmlns:xml="http://www.w3.org/XML/1998/namespace">
jaxl_loop:100 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 0
jaxl_socket_client:174 - 2013-04-05 23:00:57 - read 173/173 of data
jaxl_socket_client:175 - 2013-04-05 23:00:57 - <?xml version="1.0"?><stream:stream id="E21DE38D" from="chat.facebook.com" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en">
jaxl_fsm:56 - 2013-04-05 23:00:57 - calling state handler 'wait_for_stream_start' for incoming event 'start_cb'
jaxl_fsm:65 - 2013-04-05 23:00:57 - current state 'wait_for_stream_features'
jaxl_socket_client:174 - 2013-04-05 23:00:57 - read 227/400 of data
jaxl_socket_client:175 - 2013-04-05 23:00:57 - <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features>
jaxl_fsm:56 - 2013-04-05 23:00:57 - calling state handler 'wait_for_stream_features' for incoming event 'stanza_cb'
jaxl_loop:82 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 1
jaxl_fsm:65 - 2013-04-05 23:00:57 - current state 'wait_for_tls_result'
jaxl_socket_client:187 - 2013-04-05 23:00:57 - sent 61/287 of data
jaxl_socket_client:188 - 2013-04-05 23:00:57 - <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls>
jaxl_loop:100 - 2013-04-05 23:00:57 - active read fds: 1, write fds: 0
jaxl_socket_client:174 - 2013-04-05 23:00:58 - read 50/450 of data
jaxl_socket_client:175 - 2013-04-05 23:00:58 - <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
jaxl_fsm:56 - 2013-04-05 23:00:58 - calling state handler 'wait_for_tls_result' for incoming event 'stanza_cb'
jaxl_exception:48 - 2013-04-05 23:00:58 - got jaxl exception construct with stream_socket_enable_crypto() [<a href='streams.crypto'>streams.crypto</a>]: this stream does not support SSL/crypto, 2, D:\wamp\www\jaxl\core\jaxl_socket_client.php, 127
jaxl_exception:75 - 2013-04-05 23:00:58 - exception handler catched "xdebug_message":"<tr><th align='left' bgcolor='#f57900' colspan=\"5\"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )<\/span> JAXLException: stream_socket_enable_crypto() [<a href='streams.crypto'>streams.crypto<\/a>]: this stream does not support SSL\/crypto in D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php on line <i>127<\/i><\/th><\/tr>\n<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack<\/th><\/tr>\n<tr><th align='center' bgcolor='#eeeeec'>#<\/th><th align='left' bgcolor='#eeeeec'>Time<\/th><th align='left' bgcolor='#eeeeec'>Memory<\/th><th align='left' bgcolor='#eeeeec'>Function<\/th><th align='left' bgcolor='#eeeeec'>Location<\/th><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>1<\/td><td bgcolor='#eeeeec' align='center'>0.0005<\/td><td bgcolor='#eeeeec' align='right'>396352<\/td><td bgcolor='#eeeeec'>main(  )<\/td><td title='D:\\wamp\\www\\jaxl\\examples\\xfacebook_platform_client.php' bgcolor='#eeeeec'>..\\xfacebook_platform_client.php<b>:<\/b>0<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>2<\/td><td bgcolor='#eeeeec' align='center'>0.0211<\/td><td bgcolor='#eeeeec' align='right'>1553464<\/td><td bgcolor='#eeeeec'>JAXL->start(  )<\/td><td title='D:\\wamp\\www\\jaxl\\examples\\xfacebook_platform_client.php' bgcolor='#eeeeec'>..\\xfacebook_platform_client.php<b>:<\/b>71<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>3<\/td><td bgcolor='#eeeeec' align='center'>0.5094<\/td><td bgcolor='#eeeeec' align='right'>1556144<\/td><td bgcolor='#eeeeec'>JAXLLoop::run(  )<\/td><td title='D:\\wamp\\www\\jaxl\\jaxl.php' bgcolor='#eeeeec'>..\\jaxl.php<b>:<\/b>386<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>4<\/td><td bgcolor='#eeeeec' align='center'>0.9847<\/td><td bgcolor='#eeeeec' align='right'>1570632<\/td><td bgcolor='#eeeeec'>JAXLLoop::select(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_loop.php' bgcolor='#eeeeec'>..\\jaxl_loop.php<b>:<\/b>109<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>5<\/td><td bgcolor='#eeeeec' align='center'>0.9883<\/td><td bgcolor='#eeeeec' align='right'>1571360<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/call_user_func' target='_new'>call_user_func<\/a>\n(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_loop.php' bgcolor='#eeeeec'>..\\jaxl_loop.php<b>:<\/b>133<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>6<\/td><td bgcolor='#eeeeec' align='center'>0.9883<\/td><td bgcolor='#eeeeec' align='right'>1571376<\/td><td bgcolor='#eeeeec'>JAXLSocketClient->on_read_ready(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_loop.php' bgcolor='#eeeeec'>..\\jaxl_loop.php<b>:<\/b>133<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>7<\/td><td bgcolor='#eeeeec' align='center'>0.9915<\/td><td bgcolor='#eeeeec' align='right'>1572888<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/call_user_func' target='_new'>call_user_func<\/a>\n(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php' bgcolor='#eeeeec'>..\\jaxl_socket_client.php<b>:<\/b>178<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>8<\/td><td bgcolor='#eeeeec' align='center'>0.9915<\/td><td bgcolor='#eeeeec' align='right'>1572936<\/td><td bgcolor='#eeeeec'>JAXLXmlStream->parse(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php' bgcolor='#eeeeec'>..\\jaxl_socket_client.php<b>:<\/b>178<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>9<\/td><td bgcolor='#eeeeec' align='center'>0.9916<\/td><td bgcolor='#eeeeec' align='right'>1573000<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/xml_parse' target='_new'>xml_parse<\/a>\n(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_xml_stream.php' bgcolor='#eeeeec'>..\\jaxl_xml_stream.php<b>:<\/b>92<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>10<\/td><td bgcolor='#eeeeec' align='center'>0.9916<\/td><td bgcolor='#eeeeec' align='right'>1573960<\/td><td bgcolor='#eeeeec'>JAXLXmlStream->handle_end_tag(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_xml_stream.php' bgcolor='#eeeeec'>..\\jaxl_xml_stream.php<b>:<\/b>92<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>11<\/td><td bgcolor='#eeeeec' align='center'>0.9917<\/td><td bgcolor='#eeeeec' align='right'>1574328<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/call_user_func' target='_new'>call_user_func<\/a>\n(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_xml_stream.php' bgcolor='#eeeeec'>..\\jaxl_xml_stream.php<b>:<\/b>163<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>12<\/td><td bgcolor='#eeeeec' align='center'>0.9917<\/td><td bgcolor='#eeeeec' align='right'>1574720<\/td><td bgcolor='#eeeeec'>JAXLFsm->__call(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_xml_stream.php' bgcolor='#eeeeec'>..\\jaxl_xml_stream.php<b>:<\/b>0<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>13<\/td><td bgcolor='#eeeeec' align='center'>0.9932<\/td><td bgcolor='#eeeeec' align='right'>1576088<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/call_user_func' target='_new'>call_user_func<\/a>\n(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_fsm.php' bgcolor='#eeeeec'>..\\jaxl_fsm.php<b>:<\/b>58<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>14<\/td><td bgcolor='#eeeeec' align='center'>0.9933<\/td><td bgcolor='#eeeeec' align='right'>1576136<\/td><td bgcolor='#eeeeec'>XMPPStream->wait_for_tls_result(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_fsm.php' bgcolor='#eeeeec'>..\\jaxl_fsm.php<b>:<\/b>58<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>15<\/td><td bgcolor='#eeeeec' align='center'>0.9933<\/td><td bgcolor='#eeeeec' align='right'>1576136<\/td><td bgcolor='#eeeeec'>JAXLSocketClient->crypt(  )<\/td><td title='D:\\wamp\\www\\jaxl\\xmpp\\xmpp_stream.php' bgcolor='#eeeeec'>..\\xmpp_stream.php<b>:<\/b>483<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>16<\/td><td bgcolor='#eeeeec' align='center'>0.9933<\/td><td bgcolor='#eeeeec' align='right'>1576232<\/td><td bgcolor='#eeeeec'><a href='http:\/\/www.php.net\/stream_socket_enable_crypto' target='_new'>stream_socket_enable_crypto<\/a>\n(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php' bgcolor='#eeeeec'>..\\jaxl_socket_client.php<b>:<\/b>127<\/td><\/tr>\n<tr><td bgcolor='#eeeeec' align='center'>17<\/td><td bgcolor='#eeeeec' align='center'>0.9933<\/td><td bgcolor='#eeeeec' align='right'>1577176<\/td><td bgcolor='#eeeeec'>JAXLException::error_handler(  )<\/td><td title='D:\\wamp\\www\\jaxl\\core\\jaxl_socket_client.php' bgcolor='#eeeeec'>..\\jaxl_socket_client.php<b>:<\/b>127<\/td><\/tr>\n"
jaxl:228 - 2013-04-05 23:00:58 - cleaning up pid and unix sock files
jaxl_clock:55 - 2013-04-05 23:00:58 - shutting down clock server...

我已经在 PHP.INI 中启用了 extension=php_openssl.dll。 请帮我解决它。有什么想法请.. 我很快就会寻求你的帮助。谢谢

【问题讨论】:

如果不能看到有问题的代码,就很难解决问题。 是的,没错!所以你需要我展示一些代码,@Jon 吗?没关系,但我只是想知道它是相同的代码,它在控制台中运行良好,但是当我通过 broswer 运行时它会显示此错误。 :( 这就是为什么我们需要查看代码 - 看看是什么导致它在浏览器中失败。 (另外,从控制台,您是否在与浏览器相同的位置运行它?)据我所知,它可能是 apache 权限限制它。 非常感谢@jon!通过日志文件中的错误,我认为它与 php.ini 中的 openssl 有关,但我已经启用它,仍然是相同的错误消息。 :( 感谢@Jon!你认为我应该就我的问题发表答案吗?我想每个人都可以阅读我们的命令,如果他们遇到与我相同的错误,他们会得到答案。没关系,我会分享我现在遇到的。感谢所有的想法。 :) 【参考方案1】:

如果有人使用 Jaxl 库并遇到与我相同的问题。您只需通过this 安装 OpenSSL

用于窗口。一切都是 SSL 不支持的问题都可以解决。如果您像我一样尝试使用 JAXL 库,我建议您使用 http_bind 进行测试

这可能比我现在尝试的要容易。 :D

【讨论】:

以上是关于JAXL 异常:此流不支持 SSL/加密的主要内容,如果未能解决你的问题,请参考以下文章

为啥 BufferedStream.Write 会抛出“此流不支持查找操作”?

ssl不支持怎么办?

ssl支持哪种算法?

php邮件程序中的stream_socket_enable_crypto()错误

ssl协议未开启

ssl支持的协议都有哪些,有啥用?