Permalink
Browse files

Preserve protocol and use right host property

  • Loading branch information...
1 parent ab69d96 commit 3dd97dd83ce5849e1be4503fa75e9031a92e6a39 @kriszyp committed Nov 11, 2010
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/nodules-utils/node-http-client.js
@@ -22,12 +22,18 @@ exports.request = function(request){
request.pathname = request.url;
var proxySettings = parse(exports.proxyServer);
request.port = proxySettings.port;
- request.host = proxySettings.hostname;
+ request.protocol = proxySettings.protocol;
+ request.hostname = proxySettings.hostname;
}
var secure = request.protocol.indexOf("s") > -1;
- var client = http.createClient(request.port || (secure ? 443 : 80), request.host, secure);
+ var client = http.createClient(request.port || (secure ? 443 : 80), request.hostname, secure);
- var req = client.request(request.method || "GET", request.pathname || request.pathInfo, request.headers || {host: request.hostname});
+ var requestPath = request.pathname || request.pathInfo || "";
+ if (request.queryString) {
+ requestPath += "?"+request.queryString;
+ }
+
+ var req = client.request(request.method || "GET", requestPath, request.headers || {host: request.host});
var timedOut;
req.addListener("response", function (response){
if(timedOut){

0 comments on commit 3dd97dd

Please sign in to comment.