X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_api.c;h=a78416a0bcb5bc73ff0c384cfac3530ae3d1e19c;hp=8030c0f5d358df3f1bb5360d3cb57d6e3b7969a4;hb=8d25696948ed61d50c417275222117f43069ddd1;hpb=602fe384803e6f489c6e551722fff770e80ebf2d diff --git a/http_api.c b/http_api.c index 8030c0f..a78416a 100644 --- a/http_api.c +++ b/http_api.c @@ -246,6 +246,12 @@ void _http_log_ex(char *file, const char *ident, const char *message TSRMLS_DC) } /* }}} */ +static void http_ob_blackhole(char *output, uint output_len, char **handled_output, uint *handled_output_len, int mode TSRMLS_DC) +{ + *handled_output = ecalloc(1,1); + *handled_output_len = 0; +} + /* {{{ STATUS http_exit(int, char*, char*) */ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header TSRMLS_DC) { @@ -257,6 +263,7 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header return FAILURE; } + php_end_ob_buffers(0 TSRMLS_CC); if (php_header(TSRMLS_C) && body) { PHPWRITE(body, strlen(body)); } @@ -275,8 +282,12 @@ STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header STR_FREE(header); STR_FREE(body); - zend_bailout(); - /* fake */ + if (HTTP_G(force_exit)) { + zend_bailout(); + } else { + php_ob_set_internal_handler(http_ob_blackhole, 4096, "blackhole", 0 TSRMLS_CC); + } + return SUCCESS; } /* }}} */