Skip to content
This repository
Browse code

Merge pull request #22 from ebensing/master

http.createClient -> http.request
  • Loading branch information...
commit e5d0c711566c9e4ff690f672e63833b72bc76fe6 2 parents 7513d3d + 7c4d25b
Rob Ellis authored

Showing 1 changed file with 7 additions and 6 deletions. Show diff stats Hide diff stats

  1. +7 6 lib/apricot.js
13 lib/apricot.js
@@ -319,20 +319,21 @@ Apricot.open = function(file, callback, live) {
319 319
320 320 if (file.match(/^https?:\/\//)) {
321 321 var urlInfo = url.parse(file, parseQueryString=false),
322   - host = http.createClient(((urlInfo.protocol === 'http:') ? urlInfo.port || 80 : 443), urlInfo.hostname),
  322 + //host = http.createClient(((urlInfo.protocol === 'http:') ? urlInfo.port || 80 : 443), urlInfo.hostname),
323 323 req_url = urlInfo.pathname;
324 324
325 325 if (urlInfo.search) {
326 326 req_url += urlInfo.search;
327 327 }
328   - var request = host.request('GET', req_url, { host: urlInfo.hostname, "User-Agent": "Apricot" });
  328 + var request = http.request({method: 'GET', host: urlInfo.hostname, path : urlInfo.pathname, "User-Agent": "Apricot"});
  329 +
329 330
330   - request.addListener('response', function (response) {
  331 + request.on('response', function (response) {
331 332 var data = '';
332   - response.addListener('data', function (chunk) {
  333 + response.on('data', function (chunk) {
333 334 data += chunk;
334 335 });
335   - response.addListener("end", function() {
  336 + response.on("end", function() {
336 337 fnLoaderHandle(null, data);
337 338 });
338 339 });
@@ -377,4 +378,4 @@ hasClass = function(el, className) {
377 378
378 379 trim = function(text) {
379 380 return (text || "").replace( rtrim, "" );
380   -};
  381 +};

0 comments on commit e5d0c71

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