Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: dhruvbird/node-xmpp-bosh
...
head fork: dhruvbird/node-xmpp-bosh
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 2 commit comments
  • 1 contributor
Showing with 26 additions and 12 deletions.
  1. +13 −6 src/bosh-request-parser.js
  2. +13 −6 src/stream-parser.js
View
19 src/bosh-request-parser.js
@@ -59,13 +59,20 @@ dutil.copy(BoshRequestParser.prototype, {
},
_handle_end_element: function(name, attrs) {
- if (this.stanza && this.stanza.parent) {
- this.stanza = this.stanza.parent;
- } else if (this.stanza) {
- this.parsedBody = this.stanza;
- delete this.stanza;
+ if (this.stanza) {
+ var stream_name = name.split(/:/).reverse()[0];
+ if (!this.stanza.is(stream_name)) {
+ // Some other stanza was closed.
+ this.emit("error", "ending '" + name + "' but started '" + this.stanza.getName() + "'");
+ this.end();
+ } else if (this.stanza.parent) {
+ this.stanza = this.stanza.parent;
+ } else {
+ this.parsedBody = this.stanza;
+ delete this.stanza;
+ }
} else {
- // this happens some-times.
+ // This happens at times.
this.end();
}
},
View
19 src/stream-parser.js
@@ -72,13 +72,20 @@ dutil.copy(XmppStreamParser.prototype, {
return;
}
- if (this.stanza && this.stanza.parent) {
- this.stanza = this.stanza.parent;
- } else if (this.stanza) {
- this.emit("stanza", this.stanza);
- delete this.stanza;
+ if (this.stanza) {
+ var stream_name = name.split(/:/).reverse()[0];
+ if (!this.stanza.is(stream_name)) {
+ // Some other stanza was closed.
+ this.emit("error", "ending '" + name + "' but started '" + this.stanza.getName() + "'");
+ this.end();
+ } else if (this.stanza.parent) {
+ this.stanza = this.stanza.parent;
+ } else {
+ this.emit("stanza", this.stanza);
+ delete this.stanza;
+ }
} else {
- // this happens some-times.
+ // This happens at times.
this.emit("error", "end-element w/o start");
this.end();
}

Showing you all comments on commits in this comparison.

@satyamshekhar
Collaborator

This check is not required, since lib-expat takes care of this. node-expat should return false in such cases.

@dhruvbird
Owner

ah! missed this! - thanks!!

Something went wrong with that request. Please try again.