Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Commit

Permalink
revert superagent enabling for now
Browse files Browse the repository at this point in the history
tought it was related to the gzip support but it seems like
identity is still failing, or we are handling identity wrong
in superagent.
  • Loading branch information
tj committed Sep 17, 2013
1 parent 81a51f2 commit 6a04a0c
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions lib/Package.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,21 +238,37 @@ Package.prototype.getFiles = function(files, fn){
self.mkdir(dirname(dst), function(err){
if (err) return done(err);

// TODO: add netrc stuff back
// TODO: add gzip support back
var req = self.request(url);

req.on('error', done);
req.on('response', function(res){
if (200 != res.statusCode) return done(error(res, url));
var stream = fs.createWriteStream(dst);
stream.on('error', done);
res.pipe(stream);
res.on('end', done);
});

req.end();

// TODO: fix superagent...
// pipe file
var req = request.get(url);
req.set('Accept-Encoding', 'identity');
req.buffer(false);
//var req = request.get(url);
//req.set('Accept-Encoding', 'gzip');
//req.buffer(false);

// authorize call
var netrc = self.netrc[self.remote.host];
if (netrc) req.auth(netrc.login, netrc.password);
if (self.auth) req.auth(self.auth.user, self.auth.pass);

req
.on('end', done)
.on('error', done)
.pipe(fs.createWriteStream(dst))
.on('error', done);
//var netrc = self.netrc[self.remote.host];
//if (netrc) req.auth(netrc.login, netrc.password);
//if (self.auth) req.auth(self.auth.user, self.auth.pass);

//req
//.on('end', done)
//.on('error', done)
//.pipe(fs.createWriteStream(dst))
//.on('error', done);
});
});
});
Expand Down

0 comments on commit 6a04a0c

Please sign in to comment.