我正在诊断一个奇怪的网络问题,(我认为)我已将其范围缩小为行为不当的HTTP客户端或服务器以及某些HTTP1.1管道和/或Nagle的算法交互。我正在尝试禁用curl中的TCP_NODELAY作为测试。
Curl的手册页显示:
--tcp-nodelay
Turn on the TCP_NODELAY option. See the curl_easy_setopt(3) man page for details about this option.
Since 7.50.2, curl sets this option by default and you need to explicitly switch it off if you don't want it on.
Added in 7.11.2.
然后它从不解释如何显式关闭它。我尝试在环境中设置export CURLOPT_TCP_NODELAY=0
,但curl仍然在其输出中提及:
* TCP_NODELAY set
搜索互联网或Stackoverflow也没有给我答案。
那我该如何关闭呢?
答案 0 :(得分:1)
我应该更好地阅读该手册。它说:
In general, all boolean options are enabled with --option and yet again
disabled with --no-option. That is, you use the exact same option name but
prefix it with "no-". However, in this list we mostly only list and show
the --option version of them. (This concept with --no options was added in
7.19.0. Previously most options were toggled on/off on repeated use
of the same command line option.)
因此,我可以通过以下方式禁用TCP_NODELAY
:
curl -v --no-tcp-nodelay <url>
并且输出不再包含TCP_NODELAY set
消息。