let the caller care for the message headers on serialisation if read filters are...
authorMichael Wallner <mike@php.net>
Mon, 12 Nov 2012 19:29:45 +0000 (19:29 +0000)
committerMichael Wallner <mike@php.net>
Mon, 12 Nov 2012 19:29:45 +0000 (19:29 +0000)
php_http_message.c

index 912de7014b8fd87b3cbaa32894b6de483fcc927c..f8c414d5eb584cb1063cfd152c3c26fe44b27000 100644 (file)
@@ -277,9 +277,12 @@ PHP_HTTP_API void php_http_message_update_headers(php_http_message_t *msg)
 {
        zval *h;
        size_t size;
+       php_stream *s;
        TSRMLS_FETCH_FROM_CTX(msg->ts);
 
-       if ((size = php_http_message_body_size(&msg->body))) {
+       if (php_http_message_body_stream(&msg->body)->readfilters.head) {
+               /* if a read stream filter is attached to the body the caller must also care for the headers */
+       } else if ((size = php_http_message_body_size(&msg->body))) {
                MAKE_STD_ZVAL(h);
                ZVAL_LONG(h, size);
                zend_hash_update(&msg->hdrs, "Content-Length", sizeof("Content-Length"), &h, sizeof(zval *), NULL);