PHP的CURL是否会为不同句柄的curl请求重用连接?

时间:2022-02-10 08:17:50
  • the discussing requests assumed to connect to same target host
  • 假定连接到同一目标主机的讨论请求

  • "handles" -> I meant the return from curl_init()
  • “handle” - >我的意思是从curl_init()返回

  • Even document from the CURLOPT_FORBID_REUSE option doesn't mention whether if not set that option, a connection reuse can happen across different curl handle or not.
  • 即使来自CURLOPT_FORBID_REUSE选项的文档也未提及是否设置该选项,连接重用是否可以在不同的curl句柄中发生。

I googled quite a lot, even CURL's official FAQ, but cannot find explicit answer.

我搜索了很多,甚至是CURL的官方常见问题解答,但找不到明确的答案。

Remark: related to question Reusing the same curl handle. Big performance increase?, but the accepted answer didn't answer it explicitly, and no official reference.

备注:与问题有关重用相同的卷曲句柄。性能大幅增加?但是接受的答案没有明确回答,也没有官方参考。

1 个解决方案

#1


Maybe this would answer your question:

也许这会回答你的问题:

curl.haxx.se/docs/faq.html#What_about_Keep_Alive_or_persist

curl and libcurl have excellent support for persistent connections when
transferring several files from the same server. Curl will attempt to reuse
connections for all URLs specified on the same command line/config file, and 
libcurl will reuse connections for all transfers that are made using the same 
libcurl handle.

#1


Maybe this would answer your question:

也许这会回答你的问题:

curl.haxx.se/docs/faq.html#What_about_Keep_Alive_or_persist

curl and libcurl have excellent support for persistent connections when
transferring several files from the same server. Curl will attempt to reuse
connections for all URLs specified on the same command line/config file, and 
libcurl will reuse connections for all transfers that are made using the same 
libcurl handle.