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;
					}
				}
			}
        }
相关推荐
乌托邦的逃亡者7 小时前
Linux中如何检测IP冲突
linux·运维·tcp/ip
一曦的后花园7 小时前
linux搭建promethes并对接node-exporter指标
linux·运维·服务器
乌托邦的逃亡者7 小时前
CentOS/Openeuler主机中,为一个网卡设置多个IP地址
linux·运维·网络·tcp/ip·centos
拾贰_C8 小时前
【OpenClaw | openai | QQ】 配置QQ qot机器人
运维·人工智能·ubuntu·面试·prompt
桌面运维家8 小时前
服务器进程异常监控:快速定位与排障实战指南
运维·服务器
@CLoudbays_Martin118 小时前
UniApp是否能够接入SDK游戏盾呢?
服务器·网络·网络协议·tcp/ip·安全
风曦Kisaki9 小时前
# Linux Shell 编程入门 Day02:条件测试、if 判断、循环与随机数
linux·运维·chrome
木雷坞9 小时前
视觉算法环境 Docker 镜像拉取失败排查
运维·人工智能·docker·容器
郝亚军9 小时前
ubuntu 22.04如何安装libmodbus
运维·服务器·ubuntu
李日灐9 小时前
< 6 > Linux 自动化构建工具:makefile 详解 + 进度条实战小项目
linux·运维·服务器·后端·自动化·进度条·makefile