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);
</lead>
<date>2006-00-00</date>
<version>
- <release>0.23.1</release>
+ <release>0.23.2</release>
<api>0.23.0</api>
</version>
<stability>
</stability>
<license>BSD, revised</license>
<notes><![CDATA[
-* Fixed http_parse_cookie(), really.
+* Fixed message chain order in HttpRequest::getHistory().
]]></notes>
<contents>
<dir name="/">
?>
--EXPECTF--
%sTEST
-string(%d) "HTTP/1.1 200 OK
-Date: %s
-Server: Apache/%s
-X-Powered-By: PHP/5%s
-Vary: Accept-Encoding
-Content-Type: text/html
-X-Original-Transfer-Encoding: chunked
+string(%d) "PUT /.print_put.php5 HTTP/1.1
+User-Agent: PECL::HTTP/%s
+Host: dev.iworks.at
+Accept: */*
+Content-Type: text/plain
Content-Length: 281
+Expect: 100-continue
<?php
echo "-TEST\n";
?>
HTTP/1.1 100 Continue
-PUT /.print_put.php5 HTTP/1.1
-User-Agent: PECL::HTTP/%s
-Host: dev.iworks.at
-Accept: */*
-Content-Type: text/plain
+HTTP/1.1 200 OK
+Date: %s
+Server: %s
+X-Powered-By: %s
+Vary: Accept-Encoding
+Content-Type: text/html
+X-Original-Transfer-Encoding: chunked
Content-Length: 281
-Expect: 100-continue
<?php
echo "-TEST\n";
"
Done
-