curl 设置超时时间

 

使用CURL时,有两个超时时间:一个是连接超时时间,另一个是数据传输的最大允许时间。
连接超时时间用--connect-timeout参数来指定,数据传输的最大允许时间用-m参数来指定。

curl --connect-timeout 10 -m 20 "http://XXXXXXX"

连接超时的话,出错提示形如:
curl: (28) connect() timed out!
数据传输的最大允许时间超时的话,出错提示形如:
curl: (28) Operation timed out after 2000 milliseconds with 0 bytes received

 

参考:

https://www.cnblogs.com/EasonJim/p/8304927.html

posted @ 2019-08-23 21:58  anobscureretreat  阅读(15440)  评论(0编辑  收藏  举报