bolcom / libunftp

Extensible, async, cloud orientated FTP(S) server library and the core of unFTP: https://github.com/bolcom/unFTP. Follow up and talk to us on https://t.me/unftp
Apache License 2.0
182 stars 33 forks source link

REST implementation is broken #462

Closed robklg closed 1 year ago

robklg commented 1 year ago

When we do REST like this:

  1. PASV
  2. REST
  3. RETR FILE

There's a bug that in step 1, PASV calls spawn_processing() right when the client connects, which in turn calls command_executor(), it hands over the starting position with start_pos: session.start_pos. But that already happens before step 2, which means by the time RETR in step 3 gets called, it will have an outdated start_pos.

This leads to corrupt files when downloading with Cyberduck which is downloading in chunks of 1MB and restarting. But any REST would go wrong in this way.