[FFmpeg-cvslog] avformat/ftp: Support response code 125 for STOR and RETR commands
Raymond Hilseth
git at videolan.org
Mon Mar 7 02:16:41 CET 2016
ffmpeg | branch: master | Raymond Hilseth <rhi at vizrt.com> | Thu Jan 7 10:38:06 2016 +0100| [86db71b402e9f6b5782e1110ece4cb35c525d4b0] | committer: Michael Niedermayer
avformat/ftp: Support response code 125 for STOR and RETR commands
This fixes a problem where ffmpeg would hang if there is already an open
data connection, and the server sends a 125 response code in reply to a
STOR or RETR command.
Signed-off-by: Raymond Hilseth <rhi at vizrt.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=86db71b402e9f6b5782e1110ece4cb35c525d4b0
---
libavformat/ftp.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 890930c..b9fee24 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -401,10 +401,12 @@ static int ftp_file_size(FTPContext *s)
static int ftp_retrieve(FTPContext *s)
{
char command[CONTROL_BUFFER_SIZE];
- static const int retr_codes[] = {150, 0};
+ static const int retr_codes[] = {150, 125, 0};
+ int resp_code;
snprintf(command, sizeof(command), "RETR %s\r\n", s->path);
- if (ftp_send_command(s, command, retr_codes, NULL) != 150)
+ resp_code = ftp_send_command(s, command, retr_codes, NULL);
+ if (resp_code != 125 && resp_code != 150)
return AVERROR(EIO);
s->state = DOWNLOADING;
@@ -415,10 +417,12 @@ static int ftp_retrieve(FTPContext *s)
static int ftp_store(FTPContext *s)
{
char command[CONTROL_BUFFER_SIZE];
- static const int stor_codes[] = {150, 0};
+ static const int stor_codes[] = {150, 125, 0};
+ int resp_code;
snprintf(command, sizeof(command), "STOR %s\r\n", s->path);
- if (ftp_send_command(s, command, stor_codes, NULL) != 150)
+ resp_code = ftp_send_command(s, command, stor_codes, NULL);
+ if (resp_code != 125 && resp_code != 150)
return AVERROR(EIO);
s->state = UPLOADING;
More information about the ffmpeg-cvslog
mailing list