[FFmpeg-devel] [PATCH] FTP graceful close data connection to avoid server abort
Michael Niedermayer
michael at niedermayer.cc
Thu Jun 9 00:25:50 CEST 2016
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
>
> ---
> libavformat/ftp.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/ftp.c b/libavformat/ftp.c
> index 0663b47..00747bb 100644
> --- a/libavformat/ftp.c
> +++ b/libavformat/ftp.c
> @@ -220,15 +220,21 @@ static int ftp_send_command(FTPContext *s, const char
> *command,
>
> static void ftp_close_data_connection(FTPContext *s)
> {
> - ffurl_closep(&s->conn_data);
> +static const int close_codes[] = {225, 226, 0};
indention inconsistent
> +
> + if (s->conn_data) {
> + ffurl_closep(&s->conn_data);
> + // Need to wait for status, or file transfer might be aborted on
> server side
> + ftp_status(s, NULL, close_codes);
patch corrupted by a newline
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160609/0b5195c3/attachment.sig>
More information about the ffmpeg-devel
mailing list