strophe / strophejs

Strophe.js is an XMPP library for JavaScript
http://strophe.im/strophejs
MIT License
1.45k stars 361 forks source link

StropheJS doesn't respect "Invalid SID" message #76

Closed RobertLarsen closed 10 years ago

RobertLarsen commented 10 years ago

I have been having trouble with Strophe on a new server, we want to use (Tigase) but have come across a problem. We thought it was the server so we reported a problem her: https://projects.tigase.org/boards/15/topics/2423

However it turns out that it is probably Strophe that in some cases don't accept no as an answer. I have tcpdumped traffic from a connection that had the issue and saw about ten of these requests/responses per second from that connection:

POST / HTTP/1.1
Host: chat.cego.dk:5281
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: nl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://www.playtopia.com/games/javascript_playgame.php?gid=1000680&hd=true&gwindow=small
Content-Length: 111
Content-Type: text/plain; charset=UTF-8
Origin: http://www.playtopia.com
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

<body rid='2555358708' xmlns='http://jabber.org/protocol/httpbind' sid='d4ec1c1d-7707-4303-b915-0dad9a4a8845'/>

HTTP/1.1 404 Invalid SID
Content-Type: text/xml; charset=utf-8
Content-Length: 253
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
Access-Control-Max-Age: 86400
Connection: close
Server: Tigase Bosh/5.3.0-SNAPSHOT-b3596/9d863722 (2014-06-24/12:53:23)

<body type="error" xmlns="http://jabber.org/protocol/httpbind"><error type="cancel" code="404"><item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Invalid SID</text></error></body>

Strophe probably should disconnect or something but it just repeatedly sent that request.

I have bzip2 compressed and base64 encoded the PCAP file so you can see this for yourself: https://gist.github.com/RobertLarsen/1f8e9875c1bf3c15ccf9

Gordin commented 10 years ago

I'm not sure why this happens. I can reproduce a 404, but Strophe disconnects for me after that. 5b42e3aa568c564f926fb58e1acffba9d17b1544 could have fixed this though. Please try the latest git version and tell me if the problem is still there.

RobertLarsen commented 10 years ago

Thanks for the fix. I have updated my Strophe version but cannot yet say if it resolved my problem until all clients have the new version. Since we are a gaming site this may take a while. I'll get back to you on this in a day or two.

RobertLarsen commented 10 years ago

It sure seems like the problem has gone away with this fix. Thanks.