libcurl — 保持连接“打开”以上传多个文件 (FTP)

libcurl — Keep Connection “open” to Upload Multiple Files (FTP)

是的,this question 几年前就已经在这里提问和回答了。

我唯一的问题是答案与现实不符。 FTP-连接应该被重用,但事实并非如此。我的 curl 版本是 7.44.0 32/64 位,OS: linux/AIX。 详细模式和 tcpdump 都证明为每个文件上传打开一个新连接。 另外url.c:

中有这部分
/*
 * IsPipeliningPossible() returns TRUE if the options set would allow
 * pipelining/multiplexing and the connection is using a HTTP protocol.
 */
static bool IsPipeliningPossible(const struct SessionHandle *handle,
                                 const struct connectdata *conn)
  /* If a HTTP protocol and pipelining is enabled */
  if(conn->handler->protocol & PROTO_FAMILY_HTTP) {

这会阻止 FTP 协议重复使用相同的连接。

正如您通过引用源代码指出的那样,您只需修复 libcurl;因为你已经找到了开始的地方,你为什么不这样做呢?添加您自己需要的功能是免费和开源软件模型的一大优势。