如何使用nodeJS连接到隐式FTPS服务器? [英] How to connect to a implicit FTPS server with nodeJS?
问题描述
对于一个项目,我必须通过隐式连接连接到FTPS服务器. 我尝试使用node-ftp,因为它似乎是唯一一个支持隐式连接的库.
For a project I have to connect to a FTPS server over a implicit connection. I tried with node-ftp, because it seems that this is the only library, that supports the implicit connection.
我使用以下代码进行连接:
I connect using the following code:
var ftpC = new FTPClient();
ftpC.on('ready', function () {
console.log('Connection successful!');
});
ftpC.on('error', function (err) {
console.log(err);
});
console.log('Try to connect to FTP Server...');
ftpC.connect({
host: HOST_TO_CONNECT,
port: 990,
secure: 'implicit',
user: '***',
password: '***',
secureOptions: {
rejectUnauthorized: false
// secureProtocol: 'SSLv23_method',
// ciphers: 'ECDHE-RSA-AES128-GCM-SHA256'
}
})
此代码每次都给我超时错误.如果我提高超时时间,该错误会在稍后出现. 您可以在 secureOptions 中尝试添加参数 rejectUnauthorized , secureProtocol 和密码.他们都没有工作.每当我收到此超时错误.
This code gives me everytime a timeout error. If I raise the timeout, the error comes later. I tried in secureOptions to add the params rejectUnauthorized, secureProtocol and ciphers, as you can see. None of them is working. Everytime I get this timeout error.
在FileZilla中,我没有问题可以连接.一切正常.
In FileZilla I have no problem to connect. Everything is working fine.
有人对此行为有解决方案吗? 还是有另一个让Node.js连接到隐式FTPS服务器的插件?
Do someone have a solution for this behavior? Or is there another plugin for nodejs to connect to a implicit FTPS server?
推荐答案
这似乎是node-ftp
中的错误.我已经为其创建了 PR ,并将对其进行更新已修复.
This appears to be a bug in node-ftp
. I've created a PR for it and will update this as soon as it's been fixed.
这篇关于如何使用nodeJS连接到隐式FTPS服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!