|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-08-14 02:04 UTC] pierrick@php.net
-Assigned To:
+Assigned To: pierrick
[2018-09-18 01:45 UTC] pierrick@php.net
-Status: Assigned
+Status: Closed
[2018-09-18 01:45 UTC] pierrick@php.net
[2018-10-12 15:04 UTC] mimipim at abv dot bg
[2018-10-12 15:16 UTC] spam2 at rhsoft dot net
[2018-10-12 15:20 UTC] nikic@php.net
[2018-11-22 13:54 UTC] php at kanariepiet dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 19:00:01 2025 UTC |
Description: ------------ Calling curl_multi_select() causes the application to wait for a fixed, user-supplied timeout value. If the remaining configured timeout (according to CURLOPT_TIMEOUT etc.) is shorter than the select timeout, the configured timeout is only checked after the select timeout finishes. This means that the user is forced to choose a short select timeout, so that configured timeouts are checked sufficiently often. The user has no easy way to derive the correct maximum select timeout. To fix this, libcurl 7.28 introduced curl_multi_wait(), which is a select() wrapper that respects configured timeouts. I propose using this function in PHP instead of select(). Code review confirms that this has not yet been done as of today's git master. Incidentally, HHVM has already made this change. Test script: --------------- <?php $mh = curl_multi_init(); // Use address blackholed with: iptables -A INPUT -d 127.0.0.44 -j DROP $c = curl_init('http://127.0.0.44/'); curl_setopt($c, CURLOPT_TIMEOUT, 1); curl_multi_add_handle($mh, $c); do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); $t = microtime(true); while ($active && $mrc == CURLM_OK) { if (curl_multi_select($mh, 10) != -1) { do { $mrc = curl_multi_exec($mh, $active); } while ($mrc == CURLM_CALL_MULTI_PERFORM); } } print round(microtime(true) - $t) . "\n"; Expected result: ---------------- 1 Actual result: -------------- 10