fix tests
[m6w6/ext-http] / php_http_message.c
index ae7ca6e9706c16ac80e34c37fded29215329e956..4f21a838fec3d03ef0107d56f042c74051ab198b 100644 (file)
@@ -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);
@@ -909,7 +912,7 @@ static HashTable *php_http_message_object_get_props(zval *object)
                zend_property_info *pi; \
                if ((pi = zend_hash_str_find_ptr(&obj->zo.ce->properties_info, name_str, lenof(name_str)))) { \
                        action_with_tmp; \
-                       zend_hash_update(props, pi->name, &tmp); \
+                       zend_hash_update_ind(props, pi->name, &tmp); \
                } \
        } while(0)
 
@@ -1106,7 +1109,7 @@ static PHP_METHOD(HttpMessage, getHeader)
 
                if ((header = php_http_message_header(obj->message, header_str, header_len))) {
                        if (!header_ce) {
-                               RETURN_ZVAL(header, 1, 1);
+                               RETURN_ZVAL_FAST(header);
                        } else if (instanceof_function(header_ce, php_http_header_class_entry)) {
                                php_http_object_method_t cb;
                                zval argv[2];