Closed
Description
Hi,
I had some troubles with writing files in passive mode. The problem was that the server transmitted a wrong host IP to the client, but the correct ports for the passive mode. Because I had no troubles writing files with Transmit, I read it's connection protocol and found a correction of the transmitted host IP (where X.X.X.X is the wrong IP and Y.Y.Y.Y the correct one):
Cmd: PASV
227: Entering Passive Mode (X,X,X,X,195,84).
Fixing bogus PASV data address from X.X.X.X:50004 to Y.Y.Y.Y:50004.
So I came up with the idea to fix the IP address, too and added two lines to the jsftp
's getPasvSocket
method:
Ftp.prototype.getPasvSocket = function(callback) {
var self = this;
callback = once(callback || NOOP);
var host = this.host; // added
this.execute('pasv', function(err, res) {
if (err) return callback(err);
getPasvPort(res.text, function(err, options) {
if (err) return callback(err);
options.host = host; // added
var socket = self._pasvSocket = Net.createConnection(options);
socket.setTimeout(self.timeout || TIMEOUT);
socket.once('connect', function() {
self._pasvSocket = socket;
});
socket.once('close', function() {
self._pasvSocket = undefined;
});
callback(null, socket);
});
});
};
Now it works just fine.
I know it is not the perfect way to to solve this problem, but I have no idea why the server sends the "wrong" IP address...
Somebody does?
Metadata
Metadata
Assignees
Labels
No labels