FluentFTP
FluentFTP copied to clipboard
Downloading error when connecting through SOCKS4 / SOCKS4a proxy
FTP OS: Windows
FTP Server: Reproduced on WindowsServerIIS, XLight, EFT and FileZilla
Computer OS: Windows
FluentFTP Version: 38.0.0
When I am trying to download file through SOCK4 / SOCKS4a proxy I get the error: Failed to get the EPSV port from: 442629 Please note that 442629 is the file size, when I try to download different file, I got different number here, which is also a file size. When I download through SOCKS5 or without proxy at all, everything is ok. Also it works ok with TitanFTP.
Logs :
# Connect()
Status: Connecting to ***:1080
Response: 220 Xlight FTP Server 3.8 ready...
Status: Detected FTP server: XLight
Command: USER ***
Response: 331 Password required for nuser
Command: PASS ***
Response: 230 Login OK
Command: FEAT
Response: 211-Features supported
Response: REST STREAM
Response: EPRT
Response: EPSV
Response: SIZE
Response: MDTM
Response: MFMT
Response: AUTH
Response: PBSZ
Response: PROT
Response: MLST type*;size*;modify*;
Response: MLSD
Response: 211 End
Status: Text encoding: System.Text.ASCIIEncoding
Command: SYST
Response: 215 UNIX Type: L8
Status: Listing parser set to: Machine
# GetFileSize("ValidFeed.xml")
Command: SIZE ValidFeed.xml
Response: 213 442629
# Download("ValidFeed.xml")
# GetFileSize("ValidFeed.xml")
Command: SIZE ValidFeed.xml
Response: 213 442629
# OpenRead("ValidFeed.xml", Binary, 0, 442629)
Command: TYPE I
Response: 200 Type set to I.
# OpenPassiveDataStream(AutoPassive, "RETR ValidFeed.xml", 0)
Command: EPSV
Response: 229 Entering Passive Mode (|||50312|)
Status: Connecting to ***:1080
Command: RETR ValidFeed.xml
Response: 150 Opening BINARY mode data connection for ValidFeed.xml (442629 bytes).
Status: Disposing FtpSocketStream...
# OpenRead("ValidFeed.xml", Binary, 442635, 0)
# GetFileSize("ValidFeed.xml")
Command: SIZE ValidFeed.xml
Response: 226 Transfer complete (7025.857 KB/s).
# OpenPassiveDataStream(AutoPassive, "RETR ValidFeed.xml", 442635)
Command: EPSV
Response: 213 442629
Status: Disposing FtpSocketStream...
Since you contributed SOCKS4x support into the library you would be the best person to debug this.
Looks like error is gone for Windows IIS and FileZilla after these code changes (still remains for XLight though):
https://github.com/robinrodricks/FluentFTP/pull/893
Please check if this works for you:
https://www.nuget.org/packages/FluentFTP/37.1.2
I have checked it and confirm that it fixed problem for WindowsIIS and FileZilla. Unfortunately there is still Failed to get the EPSV port from: [file size] problem with XLight.
I used your same code, just kept it for proxy and not for normal FTP client since I'm not sure if it will mess something up.
Reproduced issue (using the latest version of FluentFTP) on EFT server as well
Did it work with your fork? (As I said, I used your code)
Yes, it did. It fixed issue with download restarting (for Windows IIS and FileZilla), but not "Failed to get EPSV port [file size]" issue (for XLight and EFT)
I am in process of creating a new test suite which uses dockerized FTP servers. Can you recommend any dockers for these FTP Servers which you are testing OR any of the proxies?
I am using 3proxy (https://github.com/3proxy/3proxy) as proxy server (supports both SOCKS4 and SOCKS5). There is my config for 3proxy:
auth none
log
socks
I don't use any dockers, I am using VMware Workstation 16.2.3 with Windows 11 on it, where I installed Windows IIS FTP, FileZilla, TitanFTP, XLight and EFT.
Looks like I fixed this bug for XLight and EFT too. Please see pull request #947