Merge branch 'v2.6.x'
[m6w6/ext-http] / src / php_http_client_curl.c
index be04be89296d47728cc8aa63571d7675eca35c63..1e92fbe1c1e2bb26053f9b81e5e43b995c3cd8b5 100644 (file)
@@ -177,22 +177,19 @@ static int php_http_curle_progress_callback(void *ctx, double dltotal, double dl
 #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);
        }
 
@@ -2195,6 +2192,11 @@ static ZEND_RESULT_CODE php_http_client_curl_dequeue(php_http_client_t *h, php_h
        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);