#endif
{
php_http_client_curl_handler_t *h = ctx;
- zend_bool update = 0;
if (h->progress.dl.total != dltotal
|| h->progress.dl.now != dlnow
|| h->progress.ul.total != ultotal
|| h->progress.ul.now != ulnow
) {
- update = 1;
-
h->progress.dl.total = dltotal;
h->progress.dl.now = dlnow;
h->progress.ul.total = ultotal;
h->progress.ul.now = ulnow;
}
- if (update && h->client->callback.progress.func) {
+ if (h->client->callback.progress.func) {
h->client->callback.progress.func(h->client->callback.progress.arg, h->client, &h->queue, &h->progress);
}
php_http_client_curl_t *curl = h->ctx;
php_http_client_curl_handler_t *handler = enqueue->opaque;
+ if (h->callback.depth) {
+ php_error_docref(NULL, E_WARNING, "Could not dequeue request while executing callbacks");
+ return FAILURE;
+ }
+
php_http_client_curl_handler_clear(handler);
if (CURLM_OK == (rs = curl_multi_remove_handle(curl->handle->multi, handler->handle))) {
zend_llist_del_element(&h->requests, handler->handle, (int (*)(void *, void *)) compare_queue);
{
php_http_client_curl_t *curl = h->ctx;
- if (curl->ev_ops) {
- curl->ev_ops->once(curl->ev_ctx);
- } else {
- while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(curl->handle->multi, &curl->unfinished));
- }
+ if (!h->callback.depth) {
+ if (curl->ev_ops) {
+ curl->ev_ops->once(curl->ev_ctx);
+ } else {
+ while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(curl->handle->multi, &curl->unfinished));
+ }
- php_http_client_curl_responsehandler(h);
+ php_http_client_curl_responsehandler(h);
+ }
return curl->unfinished;
-
}
static ZEND_RESULT_CODE php_http_client_curl_exec(php_http_client_t *h)
{
php_http_client_curl_t *curl = h->ctx;
- if (curl->ev_ops) {
- return curl->ev_ops->exec(curl->ev_ctx);
- }
+ if (!h->callback.depth) {
+ if (curl->ev_ops) {
+ return curl->ev_ops->exec(curl->ev_ctx);
+ }
- while (php_http_client_curl_once(h) && !EG(exception)) {
- if (SUCCESS != php_http_client_curl_wait(h, NULL)) {
+ while (php_http_client_curl_once(h) && !EG(exception)) {
+ if (SUCCESS != php_http_client_curl_wait(h, NULL)) {
#ifdef PHP_WIN32
- /* see http://msdn.microsoft.com/library/en-us/winsock/winsock/windows_sockets_error_codes_2.asp */
- php_error_docref(NULL, E_WARNING, "WinSock error: %d", WSAGetLastError());
+ /* see http://msdn.microsoft.com/library/en-us/winsock/winsock/windows_sockets_error_codes_2.asp */
+ php_error_docref(NULL, E_WARNING, "WinSock error: %d", WSAGetLastError());
#else
- php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
+ php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
#endif
- return FAILURE;
+ return FAILURE;
+ }
}
}