Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftps put file #9

Open
Kellendros007 opened this issue Nov 29, 2018 · 2 comments
Open

ftps put file #9

Kellendros007 opened this issue Nov 29, 2018 · 2 comments

Comments

@Kellendros007
Copy link

Kellendros007 commented Nov 29, 2018

In some cases when I rewrite file on ftps server file get size 0 bite. When I analyse your code I found error, in "connection.js -> FTP.prototype._store -> _pasv -> sendStore -> _send -> if (code === 150 || code === 125) -> if (isBuffer)" you send data without check that secure connection was established. As a result data not transferred to server server give code 150 and I was not see code 226. I make work around with setInterval and now it working good, but I think that my code so bad and it will be good if you resolve this issues because file with size 0 is not good.

PS. sorry for my bad English.

@amdolan-ngl
Copy link

@Kellendros007 Can you show how you fixed it?

@Kellendros007
Copy link
Author

@Kellendros007 Can you show how you fixed it?

I was change from

if (isBuffer) //line 1066
dest.end(input); //line 1067

to

if (isBuffer){
var EstablishIntervalTime = 0;
var EstablishIntervalMax = 5000;
var EstablishIntervalStep = 10;
var EstablishInterval = setInterval(function(){
EstablishIntervalTime+=EstablishIntervalStep;
if (dest._secureEstablished){
dest.end(input);
clearInterval(EstablishInterval);
} else if (EstablishIntervalTime>EstablishIntervalMax) {
clearInterval(EstablishInterval);
throw new Error("Connection not established");
}
}, EstablishIntervalStep);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants