Skip to content

Fix for simultaneous PASV requests

Compare
Choose a tag to compare
@sergi sergi released this 11 Oct 16:56
· 113 commits to master since this release

When attempting 2 simultaneous PASV requests, an ECONNREFUSED would happen and crash jsftp. With this release, an error will be generated when this happens, giving a clue on what went wrong. This is the kind of code that could cause an ECONNREFUSED before:

var JsFtp = require('jsftp'),
    ftp = new JsFtp({
        "host": "localhost",
        "user": "foo",
        "pass": "bar",
    }),
    file1 = 'foo/1.jpg',
    file2 = 'foo/2.jpg';

// Wrong way to invoke two consecutive requests!
ftp.get(file1, __dirname + '/2.jpg', function () {
    console.log('FILE1', arguments);
});
ftp.get(file2, __dirname + '/2.jpg', function () {
    console.log('FILE2', arguments);
});