What is the default time after which an HTTP request is deemed to have timed out?

我的梦境 提交于 2020-01-04 02:29:05

问题


For PHP, what is the default time after which an HTTP request is deemed to have timed out?

I'm using the PECL HTTP extension to make HTTP requests. I can set a timeout limit when making a request, however I'd like to know what the default is if nothing is explicitly specified.

I've hunted through the PHP manual to no avail. I'd appreciate answers supported by evidence, such as a link to the relevant manual page, as opposed to speculative suggestions.

I'm keen to find out what the default timeout actually is not just what it probably is. I can guess it may probably be 30 seconds as this seems a reasonable value, however I can find nothing to confirm or deny this.


回答1:


I'm quite sure what you're looking for is the default_socket_timeout php.ini option. It appears the default is 60 seconds.




回答2:


Just for future reference: http://svn.php.net/viewvc/pecl/http/trunk/http_request_api.c?view=markup

If I understood it correctly, the default timeout options values are:

  • timeout = CURLOPT_TIMEOUT_MS | CURLOPT_TIMEOUT = 0 (means "waits indefinitely")
  • connecttimeout = CURLOPT_CONNECTTIMEOUT_MS | CURLOPT_CONNECTTIMEOUT = 3
  • dns_cache_timeout = CURLOPT_DNS_CACHE_TIMEOUT = 60


来源:https://stackoverflow.com/questions/170938/what-is-the-default-time-after-which-an-http-request-is-deemed-to-have-timed-out

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!