cvs: php4 /main output.c
| From: | Zeev Suraski | Date: | Fri, 31 Aug 2001 15:56:48 +0000 |
| Subject: | cvs: php4 /main output.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-7136@lists.php.net to get a copy of this message | ||
zeev Fri Aug 31 11:56:48 2001 EDT
Modified files:
/php4/main output.c
Log:
Support multiple chunked output buffering layers
Index: php4/main/output.c
diff -u php4/main/output.c:1.76 php4/main/output.c:1.77
--- php4/main/output.c:1.76 Fri Aug 31 11:16:15 2001
+++ php4/main/output.c Fri Aug 31 11:56:48 2001
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: output.c,v 1.76 2001/08/31 15:16:15 zeev Exp $ */
+/* $Id: output.c,v 1.77 2001/08/31 15:56:48 zeev Exp $ */
#include "php.h"
#include "ext/standard/head.h"
@@ -135,6 +135,8 @@
char *to_be_destroyed_buffer;
char *to_be_destroyed_handled_output[2] = { 0, 0 };
int status;
+ php_ob_buffer *prev_ob_buffer_p=NULL;
+ php_ob_buffer orig_ob_buffer;
if (OG(ob_nesting_level)==0) {
return;
@@ -209,21 +211,28 @@
if (OG(active_ob_buffer).internal_output_handler) {
to_be_destroyed_handled_output[1] = OG(active_ob_buffer).internal_output_handler_buffer;
}
- if (OG(ob_nesting_level)>1) { /* restore previous buffer */
- php_ob_buffer *ob_buffer_p;
-
- zend_stack_top(&OG(ob_buffers), (void **) &ob_buffer_p);
- OG(active_ob_buffer) = *ob_buffer_p;
- zend_stack_del_top(&OG(ob_buffers));
- if (OG(ob_nesting_level)==2) { /* destroy the stack */
- zend_stack_destroy(&OG(ob_buffers));
- }
+ }
+ if (OG(ob_nesting_level)>1) { /* restore previous buffer */
+ zend_stack_top(&OG(ob_buffers), (void **) &prev_ob_buffer_p);
+ orig_ob_buffer = OG(active_ob_buffer);
+ OG(active_ob_buffer) = *prev_ob_buffer_p;
+ zend_stack_del_top(&OG(ob_buffers));
+ if (!just_flush && OG(ob_nesting_level)==2) { /* destroy the stack */
+ zend_stack_destroy(&OG(ob_buffers));
}
- OG(ob_nesting_level)--;
}
+ OG(ob_nesting_level)--;
if (send_buffer) {
OG(php_body_write)(final_buffer, final_buffer_length TSRMLS_CC);
+ }
+
+ if (just_flush) { /* we restored the previous ob, return to the current */
+ if (prev_ob_buffer_p) {
+ zend_stack_push(&OG(ob_buffers), &OG(active_ob_buffer), sizeof(php_ob_buffer));
+ OG(active_ob_buffer) = orig_ob_buffer;
+ }
+ OG(ob_nesting_level)++;
}
if (alternate_buffer) {