summaryrefslogtreecommitdiff
path: root/main/output.c
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-05-02 13:55:05 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-05-02 13:55:05 +0000
commit5b83e9294cac33f2a15bd28e287e507e6dd65779 (patch)
tree539ed81293808b380b199820509a602fc4a27b73 /main/output.c
parentfe84a29b3ffbcfe556575d2a079cb0b95aa83d10 (diff)
downloadphp-git-5b83e9294cac33f2a15bd28e287e507e6dd65779.tar.gz
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.
Diffstat (limited to 'main/output.c')
-rw-r--r--main/output.c13
1 files changed, 11 insertions, 2 deletions
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);
}