zendframework / zend-http

Http component from Zend Framework
BSD 3-Clause "New" or "Revised" License
134 stars 85 forks source link

Split timeout into connectionTimeout and executeTimeout #96

Closed mlocati closed 7 years ago

mlocati commented 7 years ago

Currently the adapters support only one timeout option. BTW, it would be really helpful to have to different timeouts: one used at connection time and another one used after the connection has been made.

This would be really helpful when downloading big files: in that case we currently have to set a big timeout value (for instance 120 seconds). But if the remote server is down, we have to wait 120 seconds before the request time outs.

Having a small connection timeout (eg 5 seconds) and a big execution timeout (eg 120 seconds) would solve this problem.

For instance, for the cURL adapter, we could use CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT...

mlocati commented 7 years ago

Here's a sample code to implement this for the cURL Adapter: https://github.com/zendframework/zend-http/pull/98

mlocati commented 7 years ago

I updated #98 to include the two timeouts in the Socket adapter too

ezimuel commented 7 years ago

98 is merged.