sstrigler / JSJaC

JavaScript Jabber Client Library
Other
295 stars 86 forks source link

Infinite number of requests #14

Closed ghost closed 13 years ago

ghost commented 13 years ago

Hi,

I found a little bug that I could not fix (I did not found how to stop it). It involves the connection functions, with the stream:error handler.

Here is an explanation of the bug: when I connect to a unknown XMPP host using JSJaC and node-xmpp-bosh BOSH server (which replies correctly to the connection error), JSJaC handles the "host not found" error and then send an infinite number of empty .

You can get an example here, when trying to connect to hello@anunknownhost.tld: https://www.jappix.com/

Thanks for fixing it!

Valérian Saliou Jappix founder

ghost commented 13 years ago

By the way, JSJaC seems not to handle but only . Is that up to date?

sstrigler commented 13 years ago

yes, that might be true, jsjac doesn't handle any stream:error

concerning the infinite loop I'll try to find some time these days to fix it

ghost commented 13 years ago

Great, thanks!

ghost commented 13 years ago

Hey, I found a clean way to fix it by adding this lines of code:

  // any session error?
  if(body.getAttribute('type') == 'terminate') {
    this._handleEvent('onerror',JSJaCError('503','cancel','service-unavailable'));
    return;
  }

After this line:

  var body = req.responseXML.documentElement;

In the JSJaCHttpBindingConnection.prototype._getStreamID function.

Can you send it to the repository? Thanks :)

sstrigler commented 13 years ago

Am 22.06.2011 um 22:24 schrieb Vanaryon reply@reply.github.com:

Hey, I found a clean way to fix it by adding this lines of code:

 // any session error?
 if(body.getAttribute('type') == 'terminate') {
   this._handleEvent('onerror',JSJaCError('503','cancel','service-unavailable'));
   return;
 }

After this line:

 var body = req.responseXML.documentElement;

In the JSJaCHttpBindingConnection.prototype._getStreamID function.

Can you send it to the repository? Thanks :)

Why don't you provide a proper patch for it? Or even better fork jsjac and send a pull request?

Thanks too ;)))

Steve

ghost commented 13 years ago

Laziness maybe. I will fork it now and send you the pull request!

sstrigler commented 13 years ago

Thanks :))

Am 23.06.2011 um 10:18 schrieb Vanaryon:

Laziness maybe. I will fork it now and send you the pull request!

Reply to this email directly or view it on GitHub: https://github.com/sstrigler/JSJaC/issues/14#issuecomment-1423854

ghost commented 13 years ago

The pull request has been sent ;)

sstrigler commented 13 years ago

thank you :)

Am 23.06.2011 um 13:11 schrieb Vanaryon:

The pull request has been sent ;)

Reply to this email directly or view it on GitHub: https://github.com/sstrigler/JSJaC/issues/14#issuecomment-1424530