X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_message.c;h=3d3822cfeeb8326e455e5aae29d8d1afa93e8b38;hp=6ecf6e737831eb818d75beda189f431271ea6c57;hb=2e55401943bf7835544aa37e2aeaedfac545a6bb;hpb=33be4451ab1e395c433395e8bc6014453d36827a diff --git a/php_http_message.c b/php_http_message.c index 6ecf6e7..3d3822c 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -275,6 +275,8 @@ void php_http_message_update_headers(php_http_message_t *msg) 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 (php_http_message_header(msg, ZEND_STRL("Content-Range"))) { + /* don't mess around with a Content-Range message */ } else if ((size = php_http_message_body_size(msg->body))) { ZVAL_LONG(&h, size); zend_hash_str_update(&msg->hdrs, "Content-Length", lenof("Content-Length"), &h); @@ -299,6 +301,7 @@ void php_http_message_update_headers(php_http_message_t *msg) } } else if ((cl = php_http_message_header_string(msg, ZEND_STRL("Content-Length")))) { if (!zend_string_equals_literal(cl, "0")) { + /* body->size == 0, so get rid of old Content-Length */ zend_hash_str_del(&msg->hdrs, ZEND_STRL("Content-Length")); } zend_string_release(cl);