[FFmpeg-devel] [PATCH] FTP graceful close data connection to avoid server abort

Lukasz Marek lukasz.m.luki2 at gmail.com
Thu Jun 9 01:19:48 CEST 2016

On 09.06.2016 00:25, Michael Niedermayer wrote:
> On Thu, Jun 02, 2016 at 02:29:47PM +0200, Camille Gonnet wrote:
>> When writing files to FTP, if the data connection is closed before the
>> control connection, the server may handle it as an aborted file transfer
>> and create and leave the file empty.
> which ftp server, or is that in the RFC, if so please refer to it

RFC is good for reference, unfortunately even popular linux
implementations don't follow it strictly (sometimes it is hard to say
they follow at all some aspects). Regarding aborting and stuff it is
really implementation dependent. I can't remember now which
implementation and what version, but one was totally unresponsive on
control connection while active transfer on data connection, so the only
way to abort it was to close data connection.

Reverting order of closing should be OK, but I'm not really sure
expecting all implementation to send 225/226 code is correct. I would
suggest to at least check state if it is UPLOADING and apply that change
only for this case. Perfectly this behaviour could be enabled by an
option and autodetected in ftp_connect_control_connection when server
send its name (note 220 code's message may be overwritten so an option
to enforce is needed)

More information about the ffmpeg-devel mailing list