X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_message.c;h=9432ae953f7c7a8fd5e2bce46401fd080f207628;hp=a6414e400dea8182bf3324c828d4d572e26e7d9b;hb=d7f91cdeb926694858b07d77e29e10d5617112b1;hpb=675133e438d78d42f48ad922c340e1e43bdaae11 diff --git a/php_http_message.c b/php_http_message.c index a6414e4..9432ae9 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -300,6 +300,14 @@ void php_http_message_update_headers(php_http_message_t *msg) zval_ptr_dtor(&h); } } + } else if ((h = php_http_message_header(msg, ZEND_STRL("Content-Length"), 1))) { + zval *h_cpy = php_http_ztyp(IS_LONG, h); + + zval_ptr_dtor(&h); + if (Z_LVAL_P(h_cpy)) { + zend_hash_del(&msg->hdrs, "Content-Length", sizeof("Content-Length")); + } + zval_ptr_dtor(&h_cpy); } } @@ -764,7 +772,9 @@ STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval } body_obj = zend_object_store_get_object(zbody TSRMLS_CC); - + if (!body_obj->body) { + body_obj->body = php_http_message_body_init(NULL, NULL TSRMLS_CC); + } if (msg_obj->body) { zend_objects_store_del_ref_by_handle(msg_obj->body->zv.handle TSRMLS_CC); } @@ -784,7 +794,7 @@ STATUS php_http_message_object_set_body(php_http_message_object_t *msg_obj, zval STATUS php_http_message_object_init_body_object(php_http_message_object_t *obj) { - TSRMLS_FETCH_FROM_CTX(obj); + TSRMLS_FETCH_FROM_CTX(obj->message->ts); php_http_message_body_addref(obj->message->body); return php_http_new(NULL, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, obj->message->body, (void *) &obj->body TSRMLS_CC);