X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_client.c;h=2b4a31d08a8ce10895d4baac931c9ff1cc683310;hp=8a166fc23acb5d345064dd5c2e586879d63ea1f6;hb=791511f3bc18cdc68b3f27b43d9396cf56d99e5a;hpb=51dcae85102bbf2ae1d2d41775d2a37f218b53aa diff --git a/php_http_client.c b/php_http_client.c index 8a166fc..2b4a31d 100644 --- a/php_http_client.c +++ b/php_http_client.c @@ -375,8 +375,9 @@ static void handle_history(zval *zclient, php_http_message_t *request, php_http_ zval_ptr_dtor(&new_hist); } -static STATUS handle_response(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_message_t **request, php_http_message_t **response) +static STATUS handle_response(void *arg, php_http_client_t *client, php_http_client_enqueue_t *e, php_http_message_t **response) { + zend_bool dequeue = 0; zval zclient; php_http_message_t *msg; php_http_client_progress_state_t *progress; @@ -394,7 +395,7 @@ static STATUS handle_response(void *arg, php_http_client_t *client, php_http_cli php_http_message_set_type(msg, PHP_HTTP_RESPONSE); if (z_is_true(zend_read_property(php_http_client_class_entry, &zclient, ZEND_STRL("recordHistory"), 0 TSRMLS_CC))) { - handle_history(&zclient, *request, *response TSRMLS_CC); + handle_history(&zclient, e->request, *response TSRMLS_CC); } /* hard detach, redirects etc. are in the history */ @@ -430,8 +431,8 @@ static STATUS handle_response(void *arg, php_http_client_t *client, php_http_cli zend_fcall_info_argn(&e->closure.fci TSRMLS_CC, 0); if (retval) { - if (Z_TYPE_P(retval) == IS_BOOL && Z_BVAL_P(retval)) { - php_http_client_dequeue(client, e->request); + if (Z_TYPE_P(retval) == IS_BOOL) { + dequeue = Z_BVAL_P(retval); } zval_ptr_dtor(&retval); } @@ -447,6 +448,10 @@ static STATUS handle_response(void *arg, php_http_client_t *client, php_http_cli client->callback.progress.func(client->callback.progress.arg, client, e, progress); } + if (dequeue) { + php_http_client_dequeue(client, e->request); + } + return SUCCESS; }