[ftp] Cope with RETR completion prior to all data received
authorMichael Brown <mcb30@etherboot.org>
Wed, 30 Jul 2008 19:22:49 +0000 (20:22 +0100)
committerMichael Brown <mcb30@etherboot.org>
Wed, 30 Jul 2008 19:22:49 +0000 (20:22 +0100)
commit8f4c2b4a4c5c3a3d29a102a758e75b65cadf9946
tree12303def603513d7ae85163a93c9988397845918
parentfe1f017bde2cf7279cf118806bf702647cae6d84
[ftp] Cope with RETR completion prior to all data received

Based on a patch contributed by Sergey Vlasov <vsu@altlinux.ru> :

  In my testing with "qemu -net user" the 226 response to RETR was
  often received earlier than final packets of the data connection;
  this caused the received file to become truncated without any error
  indication.  Fix this by adding an intermediate state FTP_TRANSFER
  between FTP_RETR and FTP_QUIT, so that the transfer is considered to
  be complete only when both the end of data connection is encountered
  and the final reply to the RETR command is received.
src/net/tcp/ftp.c