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;
					}
				}
			}
        }
相关推荐
雪可问春风1 天前
docker环境部署
运维·docker·容器
lwx9148522 天前
Linux-Shell算术运算
linux·运维·服务器
翻斗包菜2 天前
PostgreSQL 日常维护完全指南:从基础操作到高级运维
运维·数据库·postgresql
somi72 天前
ARM-驱动-02-Linux 内核开发环境搭建与编译
linux·运维·arm开发
海的透彻2 天前
nginx启动进程对文件的权限掌控
运维·chrome·nginx
路溪非溪2 天前
Linux驱动开发中的常用接口总结(一)
linux·运维·驱动开发
此刻觐神2 天前
IMX6ULL开发板学习-01(Linux文件目录和目录相关命令)
linux·服务器·学习
航Hang*2 天前
第3章:Linux系统安全管理——第2节:部署代理服务
linux·运维·服务器·开发语言·笔记·系统安全
fengfuyao9852 天前
VC++基于服务器的点对点文件传输实例
服务器·开发语言·c++
favour_you___2 天前
epoll惊群问题与解决
服务器·网络·tcp/ip·epoll