Skip to content
This repository was archived by the owner on May 16, 2018. It is now read-only.
This repository was archived by the owner on May 16, 2018. It is now read-only.

Incorrect application of timeout option in curl http client adapter #582

@tasso85

Description

@tasso85

Hi,

after upgrade to the latest version of ZF1, I noticed that the connect() code for Zend_Http_Client_Adapter_Curl partially changed, from

[...]
// Set timeout
curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']);
[...]

to

[...]
if (defined('CURLOPT_CONNECTTIMEOUT_MS')) {
    curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT_MS, $this->_config['timeout'] * 1000);
} else {
    curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']);
}

if (defined('CURLOPT_TIMEOUT_MS')) {
    curl_setopt($this->_curl, CURLOPT_TIMEOUT_MS, $this->_config['timeout'] * 1000);
} else {
    curl_setopt($this->_curl, CURLOPT_TIMEOUT, $this->_config['timeout']);
}
[...]

However, the second version seems to incorrectly apply the timeout parameter, which the docs states is the connection timeout, also as a general timeout.

This broke a part of our application, which relied on it to behave as stated in the docs, and now behaviour has changed.

I would therefore like to propose to split such option to timeout and connecttimeout, or something like that, to keep the behaviour separate, and also I think that the option should be set only where different from NULL.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions