ffmpeg3.1.1版本连接ftp服务器失败

发现这个问题是在ffmpeg4之后修复的:

原因在于libavformat文件下的ftp.c文件:
修改方法:加入在TCP控制连接时加入应答代码202:

cpp 复制代码
static int ftp_features(FTPContext *s)
{
    static const char *feat_command        = "FEAT\r\n";
    static const char *enable_utf8_command = "OPTS UTF8 ON\r\n";
    static const int feat_codes[] = {211, 0};
    static const int opts_codes[] = {200,202 ,451, 0};

    av_freep(&s->features);
    if (ftp_send_command(s, feat_command, feat_codes, &s->features) != 211) {
        av_freep(&s->features);
    }

	if (ftp_has_feature(s, "UTF8")) {
		int ret = ftp_send_command(s, enable_utf8_command, opts_codes, NULL);
		if (ret == 200 || ret == 202)
			s->utf8 = 1;
	}

    return 0;
}

否则的话将会引起的函数调用有:

ftp_status()--->ftp_get_line()----->ftp_getc()------->ffurl_read()------>retry_transfer_wrapper() (avic.c)
具体在ffurl_read()函数中无法退出的原因还没有得出结论

暂时先排查到ffurl_read(),总之引起的原因是状态码列表不存在服务器返回的状态码,该部分的判断在ftp_status()函数:

cpp 复制代码
 if (!code_found) {
            if (err >= 500) {
                code_found = 1;
                result = err;
			}
			else
			{
				for (i = 0;  response_codes[i]; ++i) {
					if (err == response_codes[i]) {
						code_found = 1;
						result = err;
						break;
					}
				}
			}
        }
相关推荐
Chen放放21 小时前
【华三】VXLAN-三层集中式网关配置
运维·网络
碎梦归途21 小时前
思科网络设备配置命令大全,涵盖从交换机到路由器的核心配置命令
linux·运维·服务器·网络·网络协议·路由器·交换机
七维大脑虚拟机21 小时前
飞牛NAS公网IPv6+DDNS远程访问零延迟教程
运维·服务器·网络
小天源21 小时前
nginx在centos7上热升级步骤
linux·服务器·nginx
AZ996ZA1 天前
自学linux第十八天:【Linux运维实战】系统性能优化与安全加固精要
linux·运维·安全·性能优化
一体化运维管理平台1 天前
DevOps落地利器:美信监控易如何打通开发与运维?
运维
宴之敖者、1 天前
Linux——\r,\n和缓冲区
linux·运维·服务器
LuDvei1 天前
LINUX错误提示函数
linux·运维·服务器
未来可期LJ1 天前
【Linux 系统】进程间的通信方式
linux·服务器
心理之旅1 天前
高校文献检索系统
运维·服务器·容器