dnwk / xmpphp

Automatically exported from code.google.com/p/xmpphp
0 stars 0 forks source link

Received stream processing stops if the first packet from the server has only the <stream:stream /> tag #103

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Repeatedly run the following sequence against an Openfire server using a 
localhost connection on the same machine. The problem is intermittent, 
depending on how the server responds, but the failure occurs every time the 
condition is met.

if (!empty($xmpp_password)) {
    $conn = new XMPPHP_XMPP($xmpp_server, $xmpp_port, $xmpp_user, $xmpp_password, 'xmpphp', $xmpp_resource, $printlog=true, $loglevel=XMPPHP_Log::LEVEL_VERBOSE);
    $conn->useEncryption(true);

        try {

        $conn->connect();
        $conn->processUntil('session_start');
        $conn->presence();
        $conn->message($xmpp_rcpt, $message);   
        $conn->presence($type='unavailable');
        $conn->disconnect();

    } catch(XMPPHP_Exception $e) {
        die($e->getMessage());
    }
}
2.

Run wireshark and monitor the "lo" loopback interface with the display filter 
set to "jabber". This confirms the packet relationship.

3.

What is the expected output? What do you see instead?

The message goes through if the first response from the server includes the 
stream:features tag:

[root@boser cgi-bin]# ./proc_event.sh /var/www/html/zm/events/63/233
[root@boser cgi-bin]# 1292106662 [INFO]: Connecting to tcp://127.0.0.1:5222
1292106662 [VERBOSE]: Socket is ready; send it.
1292106662 [VERBOSE]: SENT: <stream:stream to="boser" 
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" 
version="1.0">
1292106662 [VERBOSE]: Successfully sent 110 bytes.
1292106662 [VERBOSE]: RECV: <?xml version='1.0' 
encoding='UTF-8'?><stream:stream 
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" 
from="netprop1.no-ip.info" id="2358abe0" xml:lang="en" 
version="1.0"><stream:features><mechanisms 
xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mecha
nism>JIVE-SHAREDSECRET</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMO
US</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression 
xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><
auth xmlns="http://jabber.org/features/iq-auth"/><register 
xmlns="http://jabber.org/features/iq-register"/></stream:features>
1292106662 [DEBUG]: Ending MECHANISM
MECHANISM .....etc

The message does not go through if the first response is only the first tag 
even though the stream:features tag follows right after.

[root@boser cgi-bin]# ./proc_event.sh /var/www/html/zm/events/63/233
[root@boser cgi-bin]# 1292107121 [INFO]: Connecting to tcp://127.0.0.1:5222
1292107121 [VERBOSE]: Socket is ready; send it.
1292107121 [VERBOSE]: SENT: <stream:stream to="boser" 
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" 
version="1.0">
1292107121 [VERBOSE]: Successfully sent 110 bytes.
1292107121 [VERBOSE]: RECV: <?xml version='1.0' 
encoding='UTF-8'?><stream:stream 
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" 
from="netprop1.no-ip.info" id="29e6e2d4" xml:lang="en" version="1.0">
1292107121 [VERBOSE]: RECV: <stream:features><mechanisms 
xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mecha
nism>JIVE-SHAREDSECRET</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMO
US</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression 
xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><
auth xmlns="http://jabber.org/features/iq-auth"/><register 
xmlns="http://jabber.org/features/iq-register"/></stream:features> ....STOPS 
HERE

What version of the product are you using? On what operating system?

https://github.com/cweiske/xmpphp.git May 30, 2010
Openfire Version: 3.7.0 Beta 
CentOS 5.5 32bit OS

Please provide any additional information below.

Original issue reported on code.google.com by hewmor...@yahoo.com on 11 Dec 2010 at 11:30

GoogleCodeExporter commented 9 years ago
Please remove this duplicate - there was some problem on the server when I 
added  issue 102, and this was created in error.

Original comment by hewmor...@yahoo.com on 13 Dec 2010 at 9:56