Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from shorrockin/master

bug fix for handling redirection errors
  • Loading branch information...
commit 3d1f785d4f83c074ec919d00365cbe38402ed4bf 2 parents 60842d8 + 05faa8b
@olalonde authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 index.js
View
9 index.js
@@ -90,7 +90,14 @@ for (var protocol in protocols) {
var proto = url.parse(redirectUrl).protocol;
proto = proto.substr(0, proto.length - 1);
//console.log('Redirecting from ' + reqUrl + ' to ' + redirectUrl);
- return module.exports[proto].get(redirectUrl, redirectCallback(reqUrl, redirect), redirect);
+
+ var out = module.exports[proto].get(redirectUrl, redirectCallback(reqUrl, redirect), redirect);
+
+ // bubble errors that occur on the redirect back up to the initiating client request
+ // object, otherwise they wind up killing the process.
+ out.on("error", function(err) { clientRequest.emit("error", err) });
+
+ return out;
};
}
Please sign in to comment.
Something went wrong with that request. Please try again.