Issue Type: Bug Created: 2009-10-16T08:22:29.000+0000 Last Updated: 2009-11-20T08:09:25.000+0000 Status: Resolved Fix version(s): - 1.9.6 (24/Nov/09)
Reporter: Lee Parker (wlp1979) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Http_Client
Related issues: - ZF-8353
When the Curl adapter creates the curl handle it translates the Zend_Http_Client timeout setting into CURLOPT_TIMEOUT. This causes problems when using the adapter for file uploads. The Curl adapter should translate the timeout into CURLOPT_CONNECTTIMEOUT as this is the more compatible setting to how the timeout is used in other adapters.
Here is a patch which fixes the issue:
<pre class="highlight"> Index: Http/Client/Adapter/Curl.php =================================================================== --- Http/Client/Adapter/Curl.php (revision 549) +++ Http/Client/Adapter/Curl.php (working copy) @@ -78,7 +78,7 @@ CURLOPT_INFILESIZE, CURLOPT_PORT, CURLOPT_MAXREDIRS, - CURLOPT_TIMEOUT, + CURLOPT_CONNECTTIMEOUT, CURL_HTTP_VERSION_1_1, CURL_HTTP_VERSION_1_0, ); @@ -196,7 +196,7 @@ } // Set timeout - curl_setopt($this->_curl, CURLOPT_TIMEOUT, $this->_config['timeout']); + curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']); // Set Max redirects curl_setopt($this->_curl, CURLOPT_MAXREDIRS, $this->_config['maxredirects']);
Posted by Satoru Yoshida (satoruyoshida) on 2009-10-18T21:16:33.000+0000
Hi, Lee. I agree as 2nd change. Because the following method is used in connect() function for setting connection parameters.
<pre class="highlight"> curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']);
But, It is hard to understand for me to change $_invalidOverwritableCurlOptions definition. Because this array is used in write() function for setting additional curl options in curl execution.
Do you have any idea?
Posted by Lee Parker (wlp1979) on 2009-10-19T06:35:19.000+0000
It seems that we do want to prevent people from attempting to change the connect timeout setting as that has already been used. However, the timeout setting might be something people will change after the adapter has been constructed. This will allow people to set a timeout for a specific call and then change it again for another call.
Posted by Satoru Yoshida (satoruyoshida) on 2009-10-28T07:07:13.000+0000
I see, now You can set CURLOPT_CONNECTIONTIMEOUT in the write() instead of the CURLOPT_TIMEOUT if you would want, but it seems to be slightly strange. :-(
So, I will change $_invalidOverwritableCurlOptions so you can set CURLOPT_TIMEOUT in the write().
Posted by Satoru Yoshida (satoruyoshida) on 2009-10-28T07:18:19.000+0000
Solved in r18727(trunk), r18728(1.9 branch)
Have you found an issue?
See the Overview section for more details.