Skip to content
Browse files

now pass redirectOptions to recursion

  • Loading branch information...
1 parent 3d1f785 commit 236bb1c258daa81289b19a52b455010cbb3ca5d7 @Slava Slava committed Jan 24, 2013
Showing with 16 additions and 2 deletions.
  1. +3 −1 .gitignore
  2. +13 −1 index.js
View
4 .gitignore
@@ -12,4 +12,6 @@ logs
results
node_modules
-npm-debug.log
+npm-debug.log
+
+.idea
View
14 index.js
@@ -91,7 +91,19 @@ for (var protocol in protocols) {
proto = proto.substr(0, proto.length - 1);
//console.log('Redirecting from ' + reqUrl + ' to ' + redirectUrl);
- var out = module.exports[proto].get(redirectUrl, redirectCallback(reqUrl, redirect), redirect);
+ // Super imslavko hack: parse ready Url
+ var searchname = url.parse(redirectUrl).search;
+ var hostname = url.parse(redirectUrl).hostname;
+ var pathname = url.parse(redirectUrl).pathname;
+
+ var redirectOptions = options;
+ redirectOptions.reqUrl = redirectUrl;
+ redirectOptions.hostname = hostname;
+ redirectOptions.path = pathname + searchname;
+
+ var out = module.exports[proto].get(redirectOptions, 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.

0 comments on commit 236bb1c

Please sign in to comment.
Something went wrong with that request. Please try again.