Browse Source

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.
experimental/new_ui_api
Yasuo Ohgaki 25 years ago
parent
commit
5b83e9294c
  1. 13
      main/output.c

13
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);
}

Loading…
Cancel
Save