shuhaib864 / xmpphp

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

Can not connect to ejabberd's mod_httpbind #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use cli_longrun_example_bosh.php
2. Point the connection stuff to your local ejabberd instance
3. run cli_longrun_example_bosh.php

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

I would the example to connect to the server. Instead it waits forever on
processUntil. This is a log of the connection:

OUT: <?xml version="1.0"?>
<body xmlns="http://jabber.org/protocol/httpbind"
xmlns:xmpp="urn:xmpp:xbosh" content="text/xml; charset=utf-8" rid="3001"
lang="en" hold="1" to="kaoskinder.de" route="xmpp:kaoskinder.de:5280"
secure="true" version="1.6" wait="1" ack="1" xmpp="urn:xmpp:xbosh"/>

IN: <body xmlns='http://jabber.org/protocol/httpbind'
sid='c9df0c2446b10c49817b3d597116520dfba6019c' wait='1' requests='2'
inactivity='30' maxpause='120' polling='2' ver='1.6' from='kaoskinder.de'
secure='true' authid='1636826938' xmlns:xmpp='urn:xmpp:xbosh'
xmlns:stream='http://etherx.jabber.org/streams'/>
OUT: <?xml version="1.0"?>
<body xmlns="http://jabber.org/protocol/httpbind"
xmlns:xmpp="urn:xmpp:xbosh" content="text/xml; charset=utf-8" rid="3002"
sid="c9df0c2446b10c49817b3d597116520dfba6019c" lang="en"/>

IN: <body xmlns='http://jabber.org/protocol/httpbind'/>
OUT: <?xml version="1.0"?>
<body xmlns="http://jabber.org/protocol/httpbind"
xmlns:xmpp="urn:xmpp:xbosh" content="text/xml; charset=utf-8" rid="3003"
sid="c9df0c2446b10c49817b3d597116520dfba6019c" lang="en"/>

IN: <body xmlns='http://jabber.org/protocol/httpbind'/>
OUT: <?xml version="1.0"?>
<body xmlns="http://jabber.org/protocol/httpbind"
xmlns:xmpp="urn:xmpp:xbosh" content="text/xml; charset=utf-8" rid="3004"
sid="c9df0c2446b10c49817b3d597116520dfba6019c" lang="en"/>

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

 * xmpphp-svn
 * php 5.2.6
 * libxml 2.7.2
 * ejabberd 2.2

Please provide any additional information below.

I think this happens because SimpleXML drops namspaces of attributes. For
example:

>> $xml = new SimpleXMLElement("<body
xmlns='http://jabber.org/protocol/httpbind' xmlns:xmpp='urn:xmpp:xbosh' />");
SimpleXMLElement::__set_state(array(
))
>> $xml->addAttribute('xml:lang','en');

>> $xml->asXML()
'<?xml version="1.0"?>
<body xmlns="http://jabber.org/protocol/httpbind"
xmlns:xmpp="urn:xmpp:xbosh" lang="en"/>
'

I tested the http-bind connection with muckl (which uses jsjac) and it
worked and which sends the namespaces.

Original issue reported on code.google.com by tim.daniel.schumacher@gmail.com on 29 Oct 2008 at 10:20

GoogleCodeExporter commented 8 years ago
Fixed it myself. It was as I expected a namespace issue. Check the attached 
patch.

Original comment by tim.daniel.schumacher@gmail.com on 30 Oct 2008 at 12:34

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks, fixed in SVN

Original comment by nathanfr...@gmail.com on 26 Nov 2008 at 10:12