Permalink
Browse files

Merge pull request #22 from ebensing/master

http.createClient -> http.request
  • Loading branch information...
2 parents 7513d3d + 7c4d25b commit e5d0c711566c9e4ff690f672e63833b72bc76fe6 @silentrob committed Jul 26, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/apricot.js
View
13 lib/apricot.js
@@ -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 e5d0c71

Please sign in to comment.