]> granicus.if.org Git - php/commitdiff
Change nest level to send Content-Length again. It seems this is the
authorYasuo Ohgaki <yohgaki@php.net>
Thu, 2 May 2002 13:55:05 +0000 (13:55 +0000)
committerYasuo Ohgaki <yohgaki@php.net>
Thu, 2 May 2002 13:55:05 +0000 (13:55 +0000)
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.

main/output.c

index 093519f3420b60bb584a9f0ea4f658cab0a4c41e..27c275c5b6a631d840a7ef32c1791a53bd9f2cd1 100644 (file)
@@ -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);
        }