Why would curl ignore CURLOPT_TIMEOUT_MS (but honor CURLOPT_TIMEOUT)?

前端 未结 2 958
生来不讨喜
生来不讨喜 2021-01-13 08:49

I am using curl to call a web service API. The service can unresponsive so I want to set a timeout. When I use CURLOPT_TIMEOUT things work as expected. But when I use CURLOP

2条回答
  •  再見小時候
    2021-01-13 09:31

    I have observed, similar issue on CentOS 5.4 system running curl version 4.3.0 and it seems whenever curl is built to use 'standard system name resolver', this behaviour kicks in.

    Work around is to use 'CURLOPT_NOSIGNAL' option along with 'CURLOPT_TIMEOUT_MS'; however this may have it's own consequences.

    Check out details on following page: https://ravidhavlesha.wordpress.com/2012/01/08/curl-timeout-problem-and-solution/

提交回复
热议问题