TurboPack / AsyncPro

Async Professional is a comprehensive communications toolkit for Embarcadero Delphi and C++Builder.
101 stars 51 forks source link

FTP bugs #32

Open torstengabrielsen opened 1 year ago

torstengabrielsen commented 1 year ago

I have been maintaining a product that is using adFTPCustomClient (and more of ADPro). Over the years I have made some small fixes locally. Some of them I can see have been implemented in the official code, but some are not. It has been some time since I made these changes and I am not 100% confident that they are correct, so I post this a suggestion to look at.

point 1) In TApdCustomFtpClient.DataConnect the code goes: <..> if PassiveMode then begin DataSocket := Sock.CreateSocket; Result := (DataSocket <> Invalid_Socket); Sock.SetAsyncStyles(DataSocket, FD_CLOSE or FD_READ or FD_WRITE); SendCommand(PopCommand); FIX: Remove SendCommand(PopCommand) so it becomes just "PopCommand" to avoid duplicate sent

Point 2) In TApdCustomFtpClient.PostStatus the code goes: <..> begin PData := nil; if (Code > scLogin) and (Code <> scProgress) then ChangeState(psIdle);

FIX: I have noted that the last line (ChangeState(psIdle), should also be guarded by this if statement: if not (ProcessState in [psGet, psPut, psDir]) then //29.may.2008, used to always change state. Replycode should handle that (or timeout)

Point 3) I believe there is bug that can let TApdCustomFtpClient.PutDate can be called before FTP response code 150 has been received. I have a pretty ugly hack to avoid that so I will not give any suggested solution

Regards, Torsten Gabrielsen

romankassebaum commented 1 year ago

I added the fixes 1) and 2). Please check them. For 3) I do not know what to do.