Permalink
Browse files

Ensure we only emit `end` once. Bump version.

  • Loading branch information...
1 parent c2877ec commit 47b7a98c61f9dfe4517401327efdf30d1b2eaf29 @danmactough committed Nov 6, 2012
Showing with 20 additions and 4 deletions.
  1. +7 −0 History.md
  2. +1 −1 README.md
  3. +11 −2 main.js
  4. +1 −1 package.json
View
@@ -1,4 +1,11 @@
+v0.10.8 / 2012-11-06
+==================
+
+ * Ensure we only emit `end` once. Bump version.
+ * Change FeedParser.parseStream so it doesn't try to attach to a `stream` that is not defined. A user could pass in a stream thinking it's valid, but the stream has been destroyed. Try not to throw.
+ * Change FeedParser#handleError to not remove 'error' listeners on `this.stream`
+
v0.10.7 / 2012-11-01
==================
View
@@ -1,4 +1,4 @@
-[![build status](https://secure.travis-ci.org/danmactough/node-feedparser.png)](http://travis-ci.org/danmactough/node-feedparser)
+[![Build Status](https://secure.travis-ci.org/danmactough/node-feedparser.png?branch=master)](https://travis-ci.org/danmactough/node-feedparser)
# Feedparser - Robust RSS, Atom, and RDF feed parsing in Node.js
This module adds methods for RSS, Atom, and RDF feed parsing in node.js using
View
13 main.js
@@ -264,6 +264,12 @@ FeedParser.prototype.handleEnd = function (){
}
if (!this.errors.length) { this.nextEmit('complete', this.meta, this.articles); }
this.nextEmit('end');
+ if (this.stream) {
+ this.stream.removeAllListeners('end');
+ this.stream.removeAllListeners('error');
+ }
+ this.stream.on('error', function() {});
+ this.stream._parser.close();
};
FeedParser.prototype.handleSaxError = function (){
@@ -1175,12 +1181,14 @@ FeedParser.parseUrl = function (url, options, callback) {
e.message = 'Remote server responded: ' + codeReason;
e.code = code;
fp.handleError(e);
+ response.request && response.request.abort();
}
}
else if (/html/.test(contentType)) {
e.message = 'Remote server did not respond with a feed';
e.code = code;
fp.handleError(e);
+ response.request && response.request.abort();
}
return;
};
@@ -1193,8 +1201,9 @@ FeedParser.parseUrl = function (url, options, callback) {
}
request(url)
.on('error', fp.handleError.bind(fp))
- .on('response', handleResponse.bind(fp))
- .pipe(fp.stream);
+ .on('response', handleResponse)
+ .pipe(fp.stream)
+ ;
return fp;
};
View
@@ -2,7 +2,7 @@
"name": "feedparser",
"author": "Dan MacTough <danmactough@gmail.com>",
"description": "Robust RSS Atom and RDF feed parsing using sax js",
- "version": "0.10.7",
+ "version": "0.10.8",
"keywords": [
"rss",
"feed",

0 comments on commit 47b7a98

Please sign in to comment.