为什么这个 CURL (shell/terminal) 命令执行失败?
Why does this CURL (shell/terminal) command fail to execute?
好吧,我被这个难住了。当我执行这个 CURL 请求时,我得到了响应。响应是代理阻止了它,但我确实收到了响应...
curl http://1.2.3.4:8080/v1/digital/foundations/content/articles?presetList=dashboard \
-H 'content-type: application/json' \
-H 'countryCode: US' \
-H 'uuid: 3456789' \
-H 'client_id: 1234'
但是,当我执行这个 CURL 请求时——唯一的变化是在开头添加 -x ""
——CURL 请求没有执行。我一直按 return 并且终端不断添加新行。我必须按 CMD-C
才能退出。
curl -x "" http://1.2.3.4:8080/v1/digital/foundations/content/articles?presetList=dashboard \
-H 'content-type: application/json' \
-H 'countryCode: US' \
-H 'uuid: 3456789' \
-H 'client_id: 1234'
这是结果。看到光标在哪里了吗?它一直在下降。
也试过这个,但还是一样...
curl --noproxy "*" \
http://1.2.3.4:8080/v1/digital/foundations/content/articles?presetList=dashboard \
-H 'content-type: application/json' \
-H 'countryCode: US' \
-H 'uuid: 3456789' \
-H 'client_id: 1234'
那么,为什么第一个执行,而第二个和第三个,我试图禁用代理,它只是坐在那里和我一起按 return 吗?我也看到其他命令偶尔也会发生这种情况,但我不知道是什么原因造成的。真郁闷。
您应该在 curl
命令中添加 -v
或 --verbose
选项,以便在您的终端上打印详细的调试信息,以帮助您追踪问题的根源。
根据man curl
:
-v, --verbose
Makes curl verbose during the operation. Useful for debugging and seeing what's going on "under the hood". A line starting with '>'
means "header data" sent by curl, '<'
means "header data" received by curl that is hidden in normal cases, and a line starting with
'*'
means additional info provided by curl.
好吧,我被这个难住了。当我执行这个 CURL 请求时,我得到了响应。响应是代理阻止了它,但我确实收到了响应...
curl http://1.2.3.4:8080/v1/digital/foundations/content/articles?presetList=dashboard \
-H 'content-type: application/json' \
-H 'countryCode: US' \
-H 'uuid: 3456789' \
-H 'client_id: 1234'
但是,当我执行这个 CURL 请求时——唯一的变化是在开头添加 -x ""
——CURL 请求没有执行。我一直按 return 并且终端不断添加新行。我必须按 CMD-C
才能退出。
curl -x "" http://1.2.3.4:8080/v1/digital/foundations/content/articles?presetList=dashboard \
-H 'content-type: application/json' \
-H 'countryCode: US' \
-H 'uuid: 3456789' \
-H 'client_id: 1234'
这是结果。看到光标在哪里了吗?它一直在下降。
也试过这个,但还是一样...
curl --noproxy "*" \
http://1.2.3.4:8080/v1/digital/foundations/content/articles?presetList=dashboard \
-H 'content-type: application/json' \
-H 'countryCode: US' \
-H 'uuid: 3456789' \
-H 'client_id: 1234'
那么,为什么第一个执行,而第二个和第三个,我试图禁用代理,它只是坐在那里和我一起按 return 吗?我也看到其他命令偶尔也会发生这种情况,但我不知道是什么原因造成的。真郁闷。
您应该在 curl
命令中添加 -v
或 --verbose
选项,以便在您的终端上打印详细的调试信息,以帮助您追踪问题的根源。
根据man curl
:
-v, --verbose
Makes curl verbose during the operation. Useful for debugging and seeing what's going on "under the hood". A line starting with
'>'
means "header data" sent by curl,'<'
means "header data" received by curl that is hidden in normal cases, and a line starting with'*'
means additional info provided by curl.