#endif
#endif
-#include "ext/standard/php_smart_str.h"
-
-#define ADD_CL_HEADER(xln) do { \
- smart_str str = {0}; \
- \
- smart_str_appends(&str, "Content-Length: "); \
- smart_str_append_long(&str, xln); \
- smart_str_0(&str); \
- sapi_add_header(str.c, str.len, 0); \
- } while(0)
-
#define OS_CODE 0x03 /* FIXME */
#define CODING_GZIP 1
#define CODING_DEFLATE 2
if (return_original) {
zval_dtor(return_value);
- } else if (do_start && do_end)
- ADD_CL_HEADER(Z_STRLEN_P(return_value));
-
+ }
+
} else {
return_original = 1;
}
do_end = (mode & PHP_OUTPUT_HANDLER_END ? 1 : 0);
if (php_deflate_string(output, output_len, handled_output, handled_output_len, ZLIBG(ob_gzip_coding), do_start, do_end, ZLIBG(output_compression_level) TSRMLS_CC)!=SUCCESS) {
zend_error(E_ERROR, "Compression failed");
- } else {
- if (do_start && do_end)
- ADD_CL_HEADER(*handled_output_len);
- }
+ }
}
/* }}} */
static void php_ob_prepend(const char *text, uint text_length);
#endif
+/* Add Content-Length: HTTP header */
+#include "ext/standard/php_smart_str.h"
+#define ADD_CL_HEADER(xln) \
+{ \
+ smart_str str = {0}; \
+ \
+ smart_str_appends(&str, "Content-Length: "); \
+ smart_str_append_long(&str, xln); \
+ smart_str_0(&str); \
+ sapi_add_header(str.c, str.len, 0); \
+}
+
#ifdef ZTS
int output_globals_id;
if (SG(headers_sent) && !SG(request_info).headers_only) {
OG(php_body_write) = php_ub_body_write_no_header;
} else {
+ ADD_CL_HEADER(OG(active_ob_buffer).text_length);
OG(php_body_write) = php_ub_body_write;
}
}