summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-01-13 17:37:25 +0000
committerZeev Suraski <zeev@php.net>2000-01-13 17:37:25 +0000
commit972631be7105a3120a405dc0d25c2dbb7179cd13 (patch)
treefce49aae99b6b0f3f2cd2f80a9a5580ff495fa6b /sapi
parentc658fc5cbdede7c8d11c7bf7eb84b342ae34c2e3 (diff)
downloadphp-git-972631be7105a3120a405dc0d25c2dbb7179cd13.tar.gz
- Added flush() support to SAPI
- Got rid of the old flush() implemenetation in favour of the new one - Added implicit_flush() support to the output buffering layer. @- Added implicit_flush() to control whether flush() should be called @ implicitly after any output (Zeev)
Diffstat (limited to 'sapi')
-rw-r--r--sapi/aolserver/aolserver.c1
-rw-r--r--sapi/apache/mod_php4.c17
-rw-r--r--sapi/cgi/cgi_main.c11
-rw-r--r--sapi/isapi/php4isapi.c5
-rw-r--r--sapi/phttpd/phttpd.c1
-rw-r--r--sapi/roxen/roxen.c7
-rw-r--r--sapi/servlet/servlet.c5
-rw-r--r--sapi/thttpd/thttpd.c2
8 files changed, 38 insertions, 11 deletions
diff --git a/sapi/aolserver/aolserver.c b/sapi/aolserver/aolserver.c
index a6e2fe96b5..2491c31f2d 100644
--- a/sapi/aolserver/aolserver.c
+++ b/sapi/aolserver/aolserver.c
@@ -297,6 +297,7 @@ static sapi_module_struct sapi_module = {
php_module_shutdown_wrapper, /* shutdown */
php_ns_sapi_ub_write, /* unbuffered write */
+ NULL, /* flush */
php_error, /* error handler */
diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c
index 9b7f2a2f57..246312be38 100644
--- a/sapi/apache/mod_php4.c
+++ b/sapi/apache/mod_php4.c
@@ -124,7 +124,7 @@ void php_save_umask(void)
}
-static int zend_apache_ub_write(const char *str, uint str_length)
+static int sapi_apache_ub_write(const char *str, uint str_length)
{
int ret;
SLS_FETCH();
@@ -143,6 +143,17 @@ static int zend_apache_ub_write(const char *str, uint str_length)
}
+
+static void sapi_apache_flush(void *server_context)
+{
+#if MODULE_MAGIC_NUMBER > 19970110
+ rflush((request_rec *) server_context);
+#else
+ bflush((request_rec *) server_context->connection->client);
+#endif
+}
+
+
int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC)
{
uint total_read_bytes=0, read_bytes;
@@ -217,7 +228,9 @@ static sapi_module_struct sapi_module = {
php_module_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
- zend_apache_ub_write, /* unbuffered write */
+ sapi_apache_ub_write, /* unbuffered write */
+ sapi_apache_flush, /* flush */
+
php_error, /* error handler */
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 7e41932c08..538861faab 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -83,12 +83,18 @@ PHPAPI extern char *optarg;
PHPAPI extern int optind;
-static int zend_cgibin_ub_write(const char *str, uint str_length)
+static int sapi_cgibin_ub_write(const char *str, uint str_length)
{
return fwrite(str, 1, str_length, stdout);
}
+static void sapi_cgibin_flush(void *server_context)
+{
+ fflush(stdout);
+}
+
+
static void sapi_cgi_send_header(sapi_header_struct *sapi_header, void *server_context)
{
if (sapi_header) {
@@ -126,7 +132,8 @@ static sapi_module_struct sapi_module = {
php_module_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
- zend_cgibin_ub_write, /* unbuffered write */
+ sapi_cgibin_ub_write, /* unbuffered write */
+ sapi_cgibin_flush, /* flush */
php_error, /* error handler */
diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c
index 3bc02b912b..f85b181d48 100644
--- a/sapi/isapi/php4isapi.c
+++ b/sapi/isapi/php4isapi.c
@@ -130,7 +130,7 @@ static zend_module_entry php_isapi_module = {
};
-static int zend_isapi_ub_write(const char *str, uint str_length)
+static int sapi_isapi_ub_write(const char *str, uint str_length)
{
DWORD num_bytes = str_length;
LPEXTENSION_CONTROL_BLOCK ecb;
@@ -296,7 +296,8 @@ static sapi_module_struct sapi_module = {
php_isapi_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
- zend_isapi_ub_write, /* unbuffered write */
+ sapi_isapi_ub_write, /* unbuffered write */
+ NULL, /* flush */
php_error, /* error handler */
diff --git a/sapi/phttpd/phttpd.c b/sapi/phttpd/phttpd.c
index a6697952cd..5906e16faf 100644
--- a/sapi/phttpd/phttpd.c
+++ b/sapi/phttpd/phttpd.c
@@ -168,6 +168,7 @@ static sapi_module_struct sapi_module = {
php_module_shutdown_wrapper, /* shutdown */
php_phttpd_sapi_ub_write, /* unbuffered write */
+ NULL, /* flush */
php_error, /* error handler */
diff --git a/sapi/roxen/roxen.c b/sapi/roxen/roxen.c
index 56d358a2d2..d9c588fa96 100644
--- a/sapi/roxen/roxen.c
+++ b/sapi/roxen/roxen.c
@@ -519,15 +519,16 @@ static sapi_module_struct sapi_module = {
"Roxen",
php_module_startup, /* startup */
- pike_module_exit, /* shutdown */
+ pike_module_exit, /* shutdown */
php_roxen_sapi_ub_write, /* unbuffered write */
+ NULL, /* flush */
php_error, /* error handler */
- php_roxen_sapi_header_handler, /* header handler */
+ php_roxen_sapi_header_handler, /* header handler */
php_roxen_sapi_send_headers, /* send headers handler */
- NULL, /* send header handler */
+ NULL, /* send header handler */
php_roxen_sapi_read_post, /* read POST data */
php_roxen_sapi_read_cookies, /* read Cookies */
diff --git a/sapi/servlet/servlet.c b/sapi/servlet/servlet.c
index 7fcce6fb3b..0682dc0578 100644
--- a/sapi/servlet/servlet.c
+++ b/sapi/servlet/servlet.c
@@ -122,7 +122,7 @@ void ThrowServletException (JNIEnv *jenv, char *msg) {
* sapi callbacks
*/
-static int zend_servlet_ub_write(const char *str, uint str_length)
+static int sapi_servlet_ub_write(const char *str, uint str_length)
{
SLS_FETCH();
if (!SG(server_context)) {
@@ -215,7 +215,8 @@ static sapi_module_struct sapi_module = {
php_module_startup, /* startup */
php_module_shutdown_wrapper, /* shutdown */
- zend_servlet_ub_write, /* unbuffered write */
+ sapi_servlet_ub_write, /* unbuffered write */
+ NULL, /* flush */
php_error, /* error handler */
diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c
index 81877c305d..fed6c578bd 100644
--- a/sapi/thttpd/thttpd.c
+++ b/sapi/thttpd/thttpd.c
@@ -108,6 +108,8 @@ static sapi_module_struct sapi_module = {
php_module_shutdown_wrapper,
sapi_thttpd_ub_write,
+ NULL,
+
php_error,
NULL,