sstrigler / JSJaC

JavaScript Jabber Client Library
Other
295 stars 86 forks source link

CORS support added #39

Closed alertby closed 12 years ago

eloycoto commented 12 years ago

Hi,

¿Work this merge?

Without merge don't run in crosdomain. And this merge run ok in chrome, firefox, but don't work in IE versions. This is the XML data for IE. custom config for ejabberd?

* IE7

XML send data:

<body 
content='text/xml; charset=utf-8' 
hold='1' 
xmlns='http://jabber.org/protocol/httpbind' 
to='172.16.21.238' 
wait='300' 
rid='686057' 
secure='false' 
newkey='b5d7e8e888359f6aea579f5e570a3f577da6accb' 
xml:lang='en' 
ver='1.8'
xmlns:xmpp='urn:xmpp:xbosh' 
xmpp:version='1.0'/>

Return:

No response from server.

_IE8 _

XML send data:

<body 
content='text/xml; charset=utf-8' 
hold='1' 
xmlns='http://jabber.org/protocol/httpbind' 
to='172.16.21.238' 
wait='300' 
rid='490267' 
secure='false' 
newkey='ac7b5909a2b8777a4b510797b345396defca4265' 
xml:lang='en' 
ver='1.8' 
xmlns:xmpp='urn:xmpp:xbosh' 
xmpp:version='1.0'/>

Return:

<body 
xmlns='http://jabber.org/protocol/httpbind' 
sid='7323bbb9b9b8cbf7f6d46a54f97cd1d8146bc538' 
wait='300' 
requests='2' 
inactivity='30' 
maxpause='120' 
polling='2' 
ver='1.8' 
from='172.16.21.238' 
secure='true' 
authid='1543288473' 
xmlns:xmpp='urn:xmpp:xbosh' 
xmlns:stream='http://etherx.jabber.org/streams' 
xmpp:version='1.0'>
<stream:features xmlns:stream='http://etherx.jabber.org/streams'>

<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>DIGEST-MD5</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
<cxmlns='http://jabber.org/protocol/caps' 
hash='sha-1' node='http://www.process-one.net/en/ejabberd/'
 ver='TQ2JFyRoSa70h2G1bpgjzuXb2sU='/>
<register xmlns='http://jabber.org/features/iq-register'/>
</stream:features>
</body>

Finis whith this:

<body xmlns='http://jabber.org/protocol/httpbind'><failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure></body>

But Chrome/firefox/Opera login correctly with this user

\ IE9 **

XML send data:

<body 
content='text/xml; charset=utf-8' 
hold='1' 
xmlns='http://jabber.org/protocol/httpbind' 
to='172.16.21.238' 
wait='300' 
rid='870867' 
secure='false' 
newkey='a0cfc59e0ba8d00dff5744e34d9733037c57c580' 
xml:lang='en' 
ver='1.6' 
xmlns:xmpp='urn:xmpp:xbosh' 
xmpp:version='1.0'
/>

Return:

<body 
xmlns='http://jabber.org/protocol/httpbind' 
sid='c9feb015dffaeb11043fd969d14b8a5e7e5c42a1' 
wait='300' 
requests='2' 
inactivity='30' 
maxpause='120' 
polling='2' 
ver='1.8' 
from='172.16.21.238' 
secure='true' 
authid='914396539' 
xmlns:xmpp='urn:xmpp:xbosh' 
xmlns:stream='http://etherx.jabber.org/streams' 
xmpp:version='1.0'>
<stream:features xmlns:stream='http://etherx.jabber.org/streams'>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>DIGEST-MD5</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
<c 
xmlns='http://jabber.org/protocol/caps' 
hash='sha-1' 
node='http://www.process-one.net/en/ejabberd/' 
ver='TQ2JFyRoSa70h2G1bpgjzuXb2sU='/>
<register xmlns='http://jabber.org/features/iq-register'/></stream:features></body>

Any solution for this cases? In Chrome/Opera/Firefox/Safari run ok. Ejjaberd configuration? Bosch version?

I check this parameters, and don't work: JSJACHBC_BOSH_VERSION = "1.8"; JSJACHBC_USE_BOSH_VER = true;

check con.connect register true and false, and don't work.

Thanks!

rraptorr commented 12 years ago

IE7 does not support crossdomain XHR at all, so crossdomain will never work in IE7.

alertby commented 12 years ago

IE use XDomainRequest from version 8. http://msdn.microsoft.com/en-us/library/ie/cc288060(v=vs.85).aspx

alertby commented 12 years ago

We use ejabberd 2.1.11.

log for IE 8:

request 1:

<body content='text/xml; charset=utf-8' hold='1' 
xmlns='http://jabber.org/protocol/httpbind'
 to='xmpp.local' wait='300' rid='670945' secure='false' newkey='d46c844c66ee11d5e71b2606f4d3d77e7c61c5ce'
 xml:lang='en' ver='1.6' xmlns:xmpp='urn:xmpp:xbosh'
 xmpp:version='1.0'/>

response:

<body xmlns='http://jabber.org/protocol/httpbind' 
sid='d53e02228371a6d9a734f3ec8a474f0fdf7e11d3' 
wait='300' requests='2' inactivity='30' maxpause='120' 
polling='2' ver='1.8' from='xmpp.local' secure='true'
 authid='739883026' xmlns:xmpp='urn:xmpp:xbosh' 
xmlns:stream='http://etherx.jabber.org/streams' xmpp:version='1.0'>
<stream:features xmlns:stream='http://etherx.jabber.org/streams'>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>F-MD5</mechanism>
<mechanism>DIGEST-MD5</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
<c xmlns='http://jabber.org/protocol/caps'
 hash='sha-1' node='http://www.process-one.net/en/ejabberd/' 
ver='TQ2JFyRoSa70h2G1bpgjzuXb2sU='/>
<register xmlns='http://jabber.org/features/iq-register'/>
</stream:features></body>

request 2:

<body rid='670946' sid='d53e02228371a6d9a734f3ec8a474f0fdf7e11d3' 
xmlns='http://jabber.org/protocol/httpbind' key='4cff9ff26a310f7bae44bf25d3d07f13f1c510d7' >
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/></body>

response:

<body xmlns='http://jabber.org/protocol/httpbind'>
<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>bm9uY2U9IjI2NDA0MTAyOTAiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge></body>

request 3:

<body rid='670947' sid='d53e02228371a6d9a734f3ec8a474f0fdf7e11d3' xmlns='http://jabber.org/protocol/httpbind' key='7c14d4882dc0758e2db661430098dfbff099930f' >
<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9IjAzbm92a2FyIixyZWFsbT0iYm9kby5nbG9vaXAubG9jYWwiLG5vbmNlPSIyNjQwNDEwMjkwIixjbm9uY2U9IkJEYVlHVU1EU05iQnE2IixuYz0iMDAwMDAwMDEiLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvYm9kby5nbG9vaXAubG9jYWwiLHJlc3BvbnNlPSIzMzMzMDAyMGY3MWRmMTZmMzdlMjk3ZTUwODNhMTkzYyIsY2hhcnNldD0idXRmLTgiAA==</response></body>

response:

<body xmlns='http://jabber.org/protocol/httpbind'>
<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cnNwYXV0aD0zYjcwMDk0YTI1YzEwMDFmYzEwYjE5YWMxZDM5N2Q1Mg==
</challenge></body>

request 4:

<body rid='670948' sid='d53e02228371a6d9a734f3ec8a474f0fdf7e11d3' xmlns='http://jabber.org/protocol/httpbind' key='0397b38c9df249104f9e66b3691dbf486cf9b936' ><response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/></body>

response:

<body xmlns='http://jabber.org/protocol/httpbind'><success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/></body>

request 5:

<body rid='670949' sid='d53e02228371a6d9a734f3ec8a474f0fdf7e11d3' xmlns='http://jabber.org/protocol/httpbind' key='d9cba0e5fea0582bd906841b9344a056bbc6b55d' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh' to='xmpp.local'> </body>

response:

<body xmlns='http://jabber.org/protocol/httpbind' sid='d53e02228371a6d9a734f3ec8a474f0fdf7e11d3' wait='300' requests='2' inactivity='30' maxpause='120' polling='2' ver='1.8' from='xmpp.local' secure='true' authid='2885733866' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' xmpp:version='1.0'><stream:features xmlns:stream='http://etherx.jabber.org/streams'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='TQ2JFyRoSa70h2G1bpgjzuXb2sU='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features></body>

request 5:

<body rid='670950' sid='d53e02228371a6d9a734f3ec8a474f0fdf7e11d3' 
xmlns='http://jabber.org/protocol/httpbind' 
key='66b555f5c5605c267fbbe70f73f8a6698101aa0d' >
<iq xmlns="jabber:client" type="set" id="bind_1">
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource xmlns="urn:ietf:params:xml:ns:xmpp-bind">jsjac_simpleclient</resource></bind></iq>
</body>

response:

<body xmlns='http://jabber.org/protocol/httpbind'>
<iq xmlns='jabber:client' id='bind_1' type='result'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>user1@xmpp.local/jsjac_simpleclient</jid>
</bind></iq></body>