Skip to content
This repository
Browse code

Upgrade to node 0.4.1

  • Loading branch information...
commit 6837b51f2dea89c9002132c51138b6046caf8f95 1 parent bee2643
Kris Zyp authored February 26, 2011
15  lib/nodules-utils/node-http-client.js
@@ -5,6 +5,7 @@ var defer = require("./promise").defer,
5 5
 	when = require("./promise").when,
6 6
 	LazyArray = require("./lazy-array").LazyArray,
7 7
 	http = require("http"),
  8
+	https = require("https"),
8 9
 	parse = require("url").parse;
9 10
 
10 11
 // configurable proxy server setting, defaults to http_proxy env var
@@ -26,15 +27,17 @@ exports.request = function(request){
26 27
 		request.hostname = proxySettings.hostname;
27 28
 	}
28 29
 	var secure = request.protocol.indexOf("s") > -1;
29  
-	var client = http.createClient(request.port || (secure ? 443 : 80), request.hostname, secure);
30  
-
31  
-	var requestPath = request.pathname || request.pathInfo || "";
  30
+	request.port = request.port || (secure ? 443 : 80);
  31
+	request.headers = request.headers || {host: request.host};
  32
+	request.host = request.hostname;
  33
+	request.method = request.method || "GET";
  34
+	request.path = request.pathname || request.pathInfo || "";
32 35
 	if (request.queryString) {
33  
-	  requestPath += "?"+request.queryString;
  36
+	  request.path += "?"+request.queryString;
34 37
 	}
35  
-
36  
-	var req = client.request(request.method || "GET", requestPath, request.headers || {host: request.host});
37 38
 	var timedOut;
  39
+
  40
+	var req = (secure ? https : http).request(request);
38 41
 	req.addListener("response", function (response){
39 42
 		if(timedOut){
40 43
 			return;
2  lib/nodules.js
@@ -2,7 +2,7 @@
2 2
 // create compile function for different platforms
3 3
 var compile = typeof process === "object" ? 
4 4
 	function(source, name){
5  
-		return process.compile("(" + source + ")", name);
  5
+		return require('vm').runInThisContext("(" + source + ")", name);
6 6
 	} :
7 7
 	typeof Packages === "object" ?
8 8
 	function(source, name){

0 notes on commit 6837b51

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