From: Yasuo Ohgaki Date: Thu, 2 May 2002 13:55:05 +0000 (+0000) Subject: Change nest level to send Content-Length again. It seems this is the X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~291 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b83e9294cac33f2a15bd28e287e507e6dd65779;p=php Change nest level to send Content-Length again. It seems this is the best setting for now. PHP will not send Content-Length always. It only sends when it is possible to send. output_buffer=0 is supposed to disable chunked output, but it seems it does not disable. It also behaves a litte strange way. This should be addressed someday. It is possible Content-Length header is not set. If it happens, try to increase chunk size for now. (i.e. output_buffer=40960) I included a little debug code for me and other develpers to play with, when (NestLevel==1 && ObStatus==5), PHP sends Content-Length. --- diff --git a/main/output.c b/main/output.c index 093519f342..27c275c5b6 100644 --- a/main/output.c +++ b/main/output.c @@ -166,6 +166,15 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS status |= PHP_OUTPUT_HANDLER_END; } +#if 0 + { + FILE *fp; + fp = fopen("/tmp/ob_log", "a"); + fprintf(fp, "NestLevel: %d ObStatus: %d HandlerName: %s\n", OG(ob_nesting_level), status, OG(active_ob_buffer).handler_name); + fclose(fp); + } +#endif + if (OG(active_ob_buffer).internal_output_handler) { final_buffer = OG(active_ob_buffer).internal_output_handler_buffer; final_buffer_length = OG(active_ob_buffer).internal_output_handler_buffer_size; @@ -239,8 +248,8 @@ PHPAPI void php_end_ob_buffer(zend_bool send_buffer, zend_bool just_flush TSRMLS OG(ob_nesting_level)--; if (send_buffer) { - /* FIXME: It's better to make it work with the last buffer */ - if (OG(ob_nesting_level) == 1 && status == (PHP_OUTPUT_HANDLER_START|PHP_OUTPUT_HANDLER_END)) + /* FIXME: chunked output behavior is needed to be checked. (Yasuo) */ + if (OG(ob_nesting_level) == 0 && !OG(active_ob_buffer).erase && status == (PHP_OUTPUT_HANDLER_START|PHP_OUTPUT_HANDLER_END)) ADD_CL_HEADER(final_buffer_length); OG(php_body_write)(final_buffer, final_buffer_length TSRMLS_CC); }