X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_request_object.c;h=46b805a262b9e26746eccbd34408a0b3ad1acd08;hb=60086d086e7f0dbfccf61931c1b2e2b410ccb5bb;hp=35c66200278a4eed9233cdf02224b4b2c736bdb1;hpb=79b54baf2c7fa5b37a4ed96a21d29c3574c1270b;p=m6w6%2Fext-http diff --git a/http_request_object.c b/http_request_object.c index 35c6620..46b805a 100644 --- a/http_request_object.c +++ b/http_request_object.c @@ -572,28 +572,17 @@ STATUS _http_request_object_responsehandler(http_request_object *obj, zval *this zval *headers, *message, *resp; if (zval_is_true(GET_PROP(recordHistory))) { - /* we need to act like a zipper, as we'll receive - * the requests and the responses in separate chains - * for redirects - */ + zval *hist, *history = GET_PROP(history); http_message *response = http_message_parse(PHPSTR_VAL(&obj->request->conv.response), PHPSTR_LEN(&obj->request->conv.response)); http_message *request = http_message_parse(PHPSTR_VAL(&obj->request->conv.request), PHPSTR_LEN(&obj->request->conv.request)); - if (response && request) { - zval *hist, *history = GET_PROP(history); - http_message *hist_msg = http_message_reverse(http_message_interconnect(response, request)); - - MAKE_STD_ZVAL(hist); - ZVAL_OBJVAL(hist, http_message_object_new_ex(http_message_object_ce, hist_msg, NULL), 0); - if (Z_TYPE_P(history) == IS_OBJECT) { - http_message_object_prepend(hist, history); - } - SET_PROP(history, hist); - zval_ptr_dtor(&hist); - } else { - http_message_free(&response); - http_message_free(&request); + MAKE_STD_ZVAL(hist); + ZVAL_OBJVAL(hist, http_message_object_new_ex(http_message_object_ce, http_message_interconnect(response, request), NULL), 0); + if (Z_TYPE_P(history) == IS_OBJECT) { + http_message_object_prepend(hist, history); } + SET_PROP(history, hist); + zval_ptr_dtor(&hist); } UPD_PROP(long, responseCode, msg->http.info.response.code);