Created
August 19, 2010 12:11
-
-
Save jeromeetienne/537719 to your computer and use it in GitHub Desktop.
patch for pkrumins/nodejs-proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From dc080c16ef4fd2c15282d3a2f0b9449c35889bab Mon Sep 17 00:00:00 2001 | |
From: Jerome Etienne <jerome.etienne@gmail.com> | |
Date: Thu, 19 Aug 2010 14:10:45 +0200 | |
Subject: [PATCH] fix request port handling | |
--- | |
proxy.js | 3 ++- | |
1 files changed, 2 insertions(+), 1 deletions(-) | |
diff --git a/proxy.js b/proxy.js | |
index 79d1995..f1e1049 100755 | |
--- a/proxy.js | |
+++ b/proxy.js | |
@@ -83,7 +83,8 @@ function server_cb(request, response) { | |
} | |
sys.log(ip + ": " + request.method + " " + request.url); | |
- var proxy = http.createClient(80, request.headers['host']) | |
+ var host = request.headers['host'].split(':'); | |
+ var proxy = http.createClient(host[1] || 80, host[0]) | |
var proxy_request = proxy.request(request.method, request.url, request.headers); | |
proxy_request.addListener('response', function(proxy_response) { | |
proxy_response.addListener('data', function(chunk) { | |
-- | |
1.7.0.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment