giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.65k stars 267 forks source link

Client hung when download empty file(bytes=0) #524

Open aimreant opened 4 years ago

aimreant commented 4 years ago

When I download empty file, process will hung until timeout, like this:

> wget -d ftp://xxxxx:8123/test123
DEBUG output created by Wget 1.10.2 (Red Hat modified) on linux-gnu.

--20:56:39--  ftp://xxxx/test123
           => `test123.37'
Resolving xxxx... 10.229.59.22
Caching xxxx => 10.229.59.22
Connecting to xxxx|10.229.59.22|:8123... connected.
Created socket 3.
Releasing 0x00000000007010d0 (new refcount 1).
Logging in as anonymous ... 220 pyftpdlib 1.5.6 ready.

--> USER anonymous

331 Username ok, send password.

--> PASS -wget@

230 Login successful.
Logged in!
==> SYST ...
--> SYST

215 UNIX Type: L8
done.    ==> PWD ...
--> PWD

257 "/" is the current directory.
done.
==> TYPE I ...
--> TYPE I

200 Type set to: Binary.
done.  ==> CWD not needed.
conaddr is: 10.229.59.22
==> PASV ...
--> PASV

227 Entering passive mode (10,229,59,22,149,157).
trying to connect to 10.229.59.22 port 38301
Created socket 4.
done.    ==> RETR test123 ...
--> RETR test123

125 Data connection already open. Transfer starting.
done.

    [          <=>                                                                                                   ] 0             --.--K/s

What I did:

> touch test_file
> wget ftp://hostname:port/test_file
aimreant commented 4 years ago

I guess, when I download empty file, the server will not return an end signal ?