Changeset 37694
- Timestamp:
- 06/14/2016 05:29:58 AM (9 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/Requests/Transport/cURL.php
r37674 r37694 177 177 $this->process_response($response, $options); 178 178 179 // Need to remove the $this reference from the curl handle. 179 // Need to remove the $this reference from the curl handle. 180 180 // Otherwise Requests_Transport_cURL wont be garbage collected and the curl_close() will never be called. 181 181 curl_setopt($this->handle, CURLOPT_HEADERFUNCTION, null); … … 350 350 } 351 351 352 if (is_int($options['timeout']) || $this->version < self::CURL_7_16_2) { 353 curl_setopt($this->handle, CURLOPT_TIMEOUT, ceil($options['timeout'])); 352 // cURL requires a minimum timeout of 1 second when using the system 353 // DNS resolver, as it uses `alarm()`, which is second resolution only. 354 // There's no way to detect which DNS resolver is being used from our 355 // end, so we need to round up regardless of the supplied timeout. 356 // 357 // https://github.com/curl/curl/blob/4f45240bc84a9aa648c8f7243be7b79e9f9323a5/lib/hostip.c#L606-L609 358 $timeout = max($options['timeout'], 1); 359 360 if (is_int($timeout) || $this->version < self::CURL_7_16_2) { 361 curl_setopt($this->handle, CURLOPT_TIMEOUT, ceil($timeout)); 354 362 } 355 363 else { 356 curl_setopt($this->handle, CURLOPT_TIMEOUT_MS, round($ options['timeout']* 1000));364 curl_setopt($this->handle, CURLOPT_TIMEOUT_MS, round($timeout * 1000)); 357 365 } 358 366 -
trunk/src/wp-includes/class-requests.php
r37674 r37694 305 305 * 306 306 * - `timeout`: How long should we wait for a response? 307 * Note: for cURL, a minimum of 1 second applies, as DNS resolution 308 * operates at second-resolution only. 307 309 * (float, seconds with a millisecond precision, default: 10, example: 0.01) 308 310 * - `connect_timeout`: How long should we wait while trying to connect?
Note: See TracChangeset
for help on using the changeset viewer.