Bug #70060 [Opn]: write events should be disabled in curl_multi_select

From: Date: Mon, 13 Jul 2015 09:07:24 +0000
Subject: Bug #70060 [Opn]: write events should be disabled in curl_multi_select
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194382@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70060&edit=1 ID: 70060 Updated by: laruence@php.net Reported by: xiaoyjy at mail dot com Summary: write events should be disabled in curl_multi_select Status: Open Type: Bug Package: cURL related Operating System: Linux PHP Version: 5.6.11 Block user comment: N Private report: N New Comment: I don't think this is a bug, as described here: http://curl.haxx.se/libcurl/c/curl_multi_fdset.html "This function extracts file descriptor information from a given multi_handle. libcurl returns its fd_set sets. The application can use these to select() on, but be sure to FD_ZERO them before calling this function as curl_multi_fdset only adds its own descriptors, it doesn't zero or otherwise remove any others. The curl_multi_perform function should be called as soon as one of them is ready to be read from or written to." that means, the write event is interested by libcurl, the requests are not sent completely yet. so, you should use a while loop, if the state changed, you should call curl_multi_exec immedidately and always checking running request in the mean time to achieve your goals thanks Previous Comments: ------------------------------------------------------------------------ [2015-07-13 08:06:22] xiaoyjy at mail dot com change Package to cURL ralated ------------------------------------------------------------------------ [2015-07-13 07:57:22] xiaoyjy at mail dot com Description: ------------ As a clent fd, writefds are always available, the select function will always return immediately if the writefds is enabled. but we only care about read events in this case. PHP_FUNCTION(curl_multi_select) { zval *z_mh; php_curlm *mh; fd_set readfds; fd_set writefds; fd_set exceptfds; int maxfd; double timeout = 1.0; struct timeval to; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|d", &z_mh, &timeout) == FAILURE) { return; } ZEND_FETCH_RESOURCE(mh, php_curlm *, &z_mh, -1, le_curl_multi_handle_name, le_curl_multi_handle); _make_timeval_struct(&to, timeout); FD_ZERO(&readfds); FD_ZERO(&writefds); FD_ZERO(&exceptfds); curl_multi_fdset(mh->multi, &readfds, &writefds, &exceptfds, &maxfd); if (maxfd == -1) { RETURN_LONG(-1); } RETURN_LONG(select(maxfd + 1, &readfds, &writefds, &exceptfds, &to)); } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70060&edit=1

« previous php.bugs (#194382) next »