Skip to content

Commit

Permalink
Use 'binary' encoding instead of 'utf8' for both main connection and …
Browse files Browse the repository at this point in the history
…PASV connection when getting directory listings
  • Loading branch information
mscdex committed Aug 29, 2012
1 parent c047eba commit b3b10f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ftp.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ var FTP = module.exports = function(options) {
this._pasvPort = undefined;
this._pasvIP = undefined;
this._feat = undefined;
this.debug = false;
this._queue = [];
this.debug = false;
this.options = {
host: 'localhost',
port: 21,
Expand Down Expand Up @@ -72,7 +72,7 @@ FTP.prototype.connect = function(port, host) {
self.emit('timeout');
}, this.options.connTimeout);
socket = this._socket = new net.Socket();
socket.setEncoding('utf8');
socket.setEncoding('binary');
socket.setTimeout(0);
socket.on('connect', function() {
clearTimeout(connTimeout);
Expand Down Expand Up @@ -488,7 +488,7 @@ FTP.prototype._pasvGetLines = function(emitter, type, cb) {
if (e)
return cb(e);
var curData = '', lines;
stream.setEncoding('utf8');
stream.setEncoding('binary');
stream.on('data', function(data) {
curData += data;
if (/\r\n|\n/.test(curData)) {
Expand Down

0 comments on commit b3b10f9

Please sign in to comment.