cvs: php4 /main output.c

From: Date: Thu, 02 May 2002 13:55:06 +0000
Subject: cvs: php4 /main output.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-11629@lists.php.net to get a copy of this message
yohgaki Thu May 2 09:55:06 2002 EDT Modified files: /php4/main output.c Log: 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. Index: php4/main/output.c diff -u php4/main/output.c:1.93 php4/main/output.c:1.94 --- php4/main/output.c:1.93 Thu May 2 02:50:18 2002 +++ php4/main/output.c Thu May 2 09:55:05 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: output.c,v 1.93 2002/05/02 06:50:18 yohgaki Exp $ */ +/* $Id: output.c,v 1.94 2002/05/02 13:55:05 yohgaki Exp $ */ #include "php.h" #include "ext/standard/head.h" @@ -166,6 +166,15 @@ 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 @@ 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); }

« previous php.cvs (#11629) next »