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 ((h = php_http_message_header(msg, ZEND_STRL("Content-Range"), 0))) {
+ /* don't mess around with a Content-Range message */
+ zval_ptr_dtor(&h);
} else if ((size = php_http_message_body_size(msg->body))) {
MAKE_STD_ZVAL(h);
ZVAL_LONG(h, size);
zval_ptr_dtor(&h);
if (Z_LVAL_P(h_cpy)) {
+ /* body->size == 0, so get rid of old Content-Length */
zend_hash_del(&msg->hdrs, "Content-Length", sizeof("Content-Length"));
}
zval_ptr_dtor(&h_cpy);
RETURN_EMPTY_STRING();
}
+#ifdef ZTS
+static size_t write_to_stream(void *s, const char *str, size_t len)
+{
+ TSRMLS_FETCH();
+ return php_stream_write(s, str, len);
+}
+#else
+# define write_to_stream (php_http_pass_callback_t)_php_stream_write
+#endif
+
ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_toStream, 0, 0, 1)
ZEND_ARG_INFO(0, stream)
ZEND_END_ARG_INFO();
PHP_HTTP_MESSAGE_OBJECT_INIT(obj);
php_stream_from_zval(s, &zstream);
- php_http_message_to_callback(obj->message, (php_http_pass_callback_t) _php_stream_write, s);
+ php_http_message_to_callback(obj->message, write_to_stream, s);
}
}