Permalink
Browse files

Upgrade to node 0.4.1

  • Loading branch information...
1 parent bee2643 commit 6837b51f2dea89c9002132c51138b6046caf8f95 @kriszyp committed Feb 27, 2011
Showing with 10 additions and 7 deletions.
  1. +9 −6 lib/nodules-utils/node-http-client.js
  2. +1 −1 lib/nodules.js
@@ -5,6 +5,7 @@ var defer = require("./promise").defer,
when = require("./promise").when,
LazyArray = require("./lazy-array").LazyArray,
http = require("http"),
+ https = require("https"),
parse = require("url").parse;
// configurable proxy server setting, defaults to http_proxy env var
@@ -26,15 +27,17 @@ exports.request = function(request){
request.hostname = proxySettings.hostname;
}
var secure = request.protocol.indexOf("s") > -1;
- var client = http.createClient(request.port || (secure ? 443 : 80), request.hostname, secure);
-
- var requestPath = request.pathname || request.pathInfo || "";
+ request.port = request.port || (secure ? 443 : 80);
+ request.headers = request.headers || {host: request.host};
+ request.host = request.hostname;
+ request.method = request.method || "GET";
+ request.path = request.pathname || request.pathInfo || "";
if (request.queryString) {
- requestPath += "?"+request.queryString;
+ request.path += "?"+request.queryString;
}
-
- var req = client.request(request.method || "GET", requestPath, request.headers || {host: request.host});
var timedOut;
+
+ var req = (secure ? https : http).request(request);
req.addListener("response", function (response){
if(timedOut){
return;
View
@@ -2,7 +2,7 @@
// create compile function for different platforms
var compile = typeof process === "object" ?
function(source, name){
- return process.compile("(" + source + ")", name);
+ return require('vm').runInThisContext("(" + source + ")", name);
} :
typeof Packages === "object" ?
function(source, name){

0 comments on commit 6837b51

Please sign in to comment.