Socket
Socket
Sign inDemoInstall

feedparser

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feedparser - npm Package Compare versions

Comparing version 0.18.1 to 0.19.0

test/feeds/invalid-characters-gzipped.xml

9

History.md
v0.19.0 / 2014-07-30
==================
* Remove unnecessary code to trigger saxparser error. Apparently, calling the callback with an error will trigger an error anyway. Totally undocumented. So, this was actually calling double error emitting.
* Manually trigger end when an exception is caught. We can't continue parsing after an exception is thrown. Also update test.
* Use native try/catch. Other method is not a performance enhancement.
* Wrap sax write and end methods in try/catch. Resolves #112 sax >= v0.6.0 can throw if a gzipped data stream containing certain characters gets written to the parser. This is a user error (to pipe gzipped data), but sometimes servers send gzipped data even when you've told them not to. So, we try to let the user handle this more gracefully.
* Add failing test case for sax throwing
v0.18.1 / 2014-06-20

@@ -3,0 +12,0 @@ ==================

19

main.js

@@ -1023,11 +1023,22 @@ /**********************************************************************

FeedParser.prototype._transform = function (data, encoding, done) {
this.stream.write(data);
done();
try {
this.stream.write(data);
done();
}
catch (e) {
done(e);
this.push(null); // Manually trigger and end, since we can't reliably do any more parsing
}
};
FeedParser.prototype._flush = function (done) {
this.stream.end();
done();
try {
this.stream.end();
done();
}
catch (e) {
done(e);
}
};
exports = module.exports = FeedParser;

@@ -5,3 +5,3 @@ {

"description": "Robust RSS Atom and RDF feed parsing using sax js",
"version": "0.18.1",
"version": "0.19.0",
"keywords": [

@@ -8,0 +8,0 @@ "rss",

@@ -26,2 +26,3 @@ describe('bad feeds', function(){

describe('duplicate guids', function () {
var feed = __dirname + '/feeds/guid-dupes.xml';

@@ -42,3 +43,24 @@

});
});
});
describe('gzipped feed', function () {
var feed = __dirname + '/feeds/invalid-characters-gzipped.xml';
it('should gracefully emit an error and not throw', function (done) {
var error;
fs.createReadStream(feed).pipe(new FeedParser())
.once('readable', function () {
done(new Error('Shouldn\'t happen'));
})
.on('error', function (err) {
error = err;
})
.on('end', function () {
assert.ok(error instanceof Error);
assert.ok(error.message.match(/^Invalid code point/));
done();
});
});

@@ -45,0 +67,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc