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;
					}
				}
			}
        }
相关推荐
linux修理工1 分钟前
armbian 安装openclaw
linux·运维·服务器
学电子她就能回来吗5 分钟前
liunx嵌入式基础:socket通信
linux·运维·服务器·人工智能·单片机·嵌入式硬件·学习
禁默6 分钟前
自动化智能体生成+外接MCP,我用 ModelEngine Nexent 5分钟手搓了一个小红书爆款收割机
运维·人工智能·自动化
风曦Kisaki6 分钟前
# Linux进阶Day06:scp远程拷贝、源码编译安装、rsync同步、inotify+rsync实时同步
linux·运维·服务器
Johnstons9 分钟前
11款网络流量监控分析软件深度对比
运维·网络·网络故障排除·网络流量分析·网络性能监控
十五年专注C++开发12 分钟前
Cocos2d - x: 一款开源跨平台 2D 游戏框架
运维·c++·游戏·开源·游戏引擎·cocos2d
liulilittle14 分钟前
游戏服务器检测扣除消耗防算数溢出的安全判断及解决方法
服务器·游戏
草莓熊Lotso17 分钟前
MySQL 索引特性与性能优化全解
android·运维·数据库·c++·mysql·性能优化
zzzsde21 分钟前
【Linux】库的制作与使用(1):库的概念及动静态库
linux·运维·服务器
软件资深者21 分钟前
iVentoy 完整使用教程:一根网线批量装系统,增强版 PXE 服务器一键部署
运维·服务器·网络·网络备份·网刻·网络安装系统