Permalink
Browse files

changed to using http.request because http.createClient has been depr…

…eciated in 0.8.3
  • Loading branch information...
1 parent 7513d3d commit 7c4d25bf66a6180da0150ec56594834081d8659a @ebensing committed Jul 26, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/apricot.js
View
@@ -319,20 +319,21 @@ Apricot.open = function(file, callback, live) {
if (file.match(/^https?:\/\//)) {
var urlInfo = url.parse(file, parseQueryString=false),
- host = http.createClient(((urlInfo.protocol === 'http:') ? urlInfo.port || 80 : 443), urlInfo.hostname),
+ //host = http.createClient(((urlInfo.protocol === 'http:') ? urlInfo.port || 80 : 443), urlInfo.hostname),
req_url = urlInfo.pathname;
if (urlInfo.search) {
req_url += urlInfo.search;
}
- var request = host.request('GET', req_url, { host: urlInfo.hostname, "User-Agent": "Apricot" });
+ var request = http.request({method: 'GET', host: urlInfo.hostname, path : urlInfo.pathname, "User-Agent": "Apricot"});
+
- request.addListener('response', function (response) {
+ request.on('response', function (response) {
var data = '';
- response.addListener('data', function (chunk) {
+ response.on('data', function (chunk) {
data += chunk;
});
- response.addListener("end", function() {
+ response.on("end", function() {
fnLoaderHandle(null, data);
});
});
@@ -377,4 +378,4 @@ hasClass = function(el, className) {
trim = function(text) {
return (text || "").replace( rtrim, "" );
-};
+};

0 comments on commit 7c4d25b

Please sign in to comment.