X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fftp.c;h=b9fee2450e7e4a2cf74f9de1ed91d4fd97daa041;hb=8f66a2da38094cf09f9b6f109bcde251e8ec7795;hp=c2a60f611546ea4496439d6443220b86b8fc7bba;hpb=55cada301049cd3a4133ac8349d3f80db2a48b97;p=ffmpeg diff --git a/libavformat/ftp.c b/libavformat/ftp.c index c2a60f61154..b9fee2450e7 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; @@ -539,7 +543,7 @@ static int ftp_connect_control_connection(URLContext *h) } /* if option is not given, don't pass it and let tcp use its own default */ err = ffurl_open_whitelist(&s->conn_control, buf, AVIO_FLAG_READ_WRITE, &h->interrupt_callback, &opts, - h->protocol_whitelist); + h->protocol_whitelist, h->protocol_blacklist); av_dict_free(&opts); if (err < 0) { av_log(h, AV_LOG_ERROR, "Cannot open control connection\n"); @@ -593,7 +597,7 @@ static int ftp_connect_data_connection(URLContext *h) } /* if option is not given, don't pass it and let tcp use its own default */ err = ffurl_open_whitelist(&s->conn_data, buf, h->flags, &h->interrupt_callback, &opts, - h->protocol_whitelist); + h->protocol_whitelist, h->protocol_blacklist); av_dict_free(&opts); if (err < 0) return err; @@ -1099,7 +1103,7 @@ cleanup: return ret; } -URLProtocol ff_ftp_protocol = { +const URLProtocol ff_ftp_protocol = { .name = "ftp", .url_open = ftp_open, .url_read = ftp_read,