X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_env_response.c;h=d88fb72841386e6eec7372ace3c1783f62fd3ea6;hp=5316bedcff50241520eb4bb0c3671f538f6043a5;hb=7ba90c6d9d6843549fb9227d1a7aa05033e60772;hpb=58410541834f8f897291c290d38e7a505dbb93c1 diff --git a/php_http_env_response.c b/php_http_env_response.c index 5316bed..d88fb72 100644 --- a/php_http_env_response.c +++ b/php_http_env_response.c @@ -182,12 +182,17 @@ static size_t output(void *context, char *buf, size_t len TSRMLS_DC) /* we really only need to flush when throttling is enabled, because we push the data as fast as possible anyway if not */ if (r->throttle.delay >= PHP_HTTP_DIFFSEC) { +#if PHP_VERSION_ID >= 50400 if (php_output_get_level(TSRMLS_C)) { php_output_flush_all(TSRMLS_C); } if (!(php_output_get_status(TSRMLS_C) & PHP_OUTPUT_IMPLICITFLUSH)) { sapi_flush(TSRMLS_C); } +#else + php_end_ob_buffer(1, 1 TSRMLS_CC); + sapi_flush(TSRMLS_C); +#endif php_http_sleep(r->throttle.delay); } return len; @@ -196,8 +201,8 @@ static size_t output(void *context, char *buf, size_t len TSRMLS_DC) #define php_http_env_response_send_done(r) php_http_env_response_send_data((r), NULL, 0) static STATUS php_http_env_response_send_data(php_http_env_response_t *r, const char *buf, size_t len) { - TSRMLS_FETCH_FROM_CTX(r->ts); size_t chunk = r->throttle.chunk ? r->throttle.chunk : PHP_HTTP_SENDBUF_SIZE; + TSRMLS_FETCH_FROM_CTX(r->ts); if (r->content.encoder) { char *enc_str = NULL;