X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_curl_client.c;h=97b04a229200e6bf70bc0d4a1e96dc93ae77c864;hp=7f4d005377065e3a7e922135732d27305c1ce0ad;hb=5913db177b07398233cb00d2357aba595eab8371;hpb=f257ab645344a43d04c089a684a3ddfd3bf3fc48 diff --git a/php_http_curl_client.c b/php_http_curl_client.c index 7f4d005..97b04a2 100644 --- a/php_http_curl_client.c +++ b/php_http_curl_client.c @@ -175,15 +175,22 @@ static int php_http_curl_client_raw_callback(CURL *ch, curl_infotype type, char switch (type) { case CURLINFO_HEADER_IN: case CURLINFO_DATA_IN: - case CURLINFO_HEADER_OUT: - case CURLINFO_DATA_OUT: - php_http_buffer_append(h->buffer, data, length); + php_http_buffer_append(h->response.buffer, data, length); if (curl->options.redirects) { flags |= PHP_HTTP_MESSAGE_PARSER_EMPTY_REDIRECTS; } - if (PHP_HTTP_MESSAGE_PARSER_STATE_FAILURE == php_http_message_parser_parse(h->parser, h->buffer, flags, &h->message)) { + if (PHP_HTTP_MESSAGE_PARSER_STATE_FAILURE == php_http_message_parser_parse(h->response.parser, h->response.buffer, flags, &h->response.message)) { + return -1; + } + break; + + case CURLINFO_HEADER_OUT: + case CURLINFO_DATA_OUT: + php_http_buffer_append(h->request.buffer, data, length); + + if (PHP_HTTP_MESSAGE_PARSER_STATE_FAILURE == php_http_message_parser_parse(h->request.parser, h->request.buffer, flags, &h->request.message)) { return -1; } break; @@ -1075,6 +1082,7 @@ PHP_HTTP_API STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_ } /* request headers */ + php_http_message_update_headers(msg); if (zend_hash_num_elements(&msg->hdrs)) { php_http_array_hashkey_t header_key = php_http_array_hashkey_init(0); zval **header_val;