Add try-catch to urlRetrieve to prevent uncaught HTTPS exceptions

This commit is contained in:
calzoneman 2013-08-11 17:44:48 -04:00
parent dba93ca3b6
commit 9c22fbc462
1 changed files with 14 additions and 10 deletions

View File

@ -17,6 +17,7 @@ var CustomEmbedFilter = require("./customembed").filter;
module.exports = function (Server) { module.exports = function (Server) {
function urlRetrieve(transport, options, callback) { function urlRetrieve(transport, options, callback) {
try {
var req = transport.request(options, function (res) { var req = transport.request(options, function (res) {
var buffer = ""; var buffer = "";
res.setEncoding("utf-8"); res.setEncoding("utf-8");
@ -29,6 +30,9 @@ module.exports = function (Server) {
}); });
req.end(); req.end();
} catch(e) {
callback(503, "");
}
} }
var Getters = { var Getters = {