mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
First part of the connection_status work. No user-callable functions
yet. That is coming next. Have also only done Apache and CGI so far. Will have to crack open my ISAPI book to do that one. Also changed the SAPI output functions to return an int. We'll check the connection status inside each one, but we might need the return code at some other level and I don't see a good reason for just tossing these return codes.
This commit is contained in:
parent
8e9cd1e4ae
commit
0bede914ab
13
main/main.c
13
main/main.c
@ -228,6 +228,7 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_BOOLEAN("track_vars", (PHP_TRACK_VARS?"1":"0"), PHP_INI_ALL, OnUpdateInt, track_vars, php_core_globals, core_globals)
|
||||
STD_PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, gpc_order, php_core_globals, core_globals)
|
||||
STD_PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, arg_separator, php_core_globals, core_globals)
|
||||
STD_PHP_INI_BOOLEAN("ignore_user_abort", "1", PHP_INI_ALL, OnUpdateInt, ignore_user_abort, php_core_globals, core_globals)
|
||||
PHP_INI_END()
|
||||
|
||||
|
||||
@ -235,14 +236,16 @@ PHP_INI_END()
|
||||
/* True global (no need for thread safety */
|
||||
static int module_initialized = 0;
|
||||
|
||||
|
||||
#if 0
|
||||
#if APACHE
|
||||
void php3_apache_puts(const char *s)
|
||||
{
|
||||
SLS_FETCH();
|
||||
|
||||
if (SG(server_context)) {
|
||||
rputs(s, (request_rec *) SG(server_context));
|
||||
if(rputs(s, (request_rec *) SG(server_context))==-1) {
|
||||
PG(connection_status) = PHP_CONNECTION_ABORTED;
|
||||
}
|
||||
} else {
|
||||
fputs(s, stdout);
|
||||
}
|
||||
@ -253,12 +256,15 @@ void php3_apache_putc(char c)
|
||||
SLS_FETCH();
|
||||
|
||||
if (SG(server_context)) {
|
||||
rputc(c, (request_rec *) SG(server_context));
|
||||
if(rputc(c, (request_rec *) SG(server_context))!=c) {
|
||||
PG(connection_status) = PHP_CONNECTION_ABORTED;
|
||||
}
|
||||
} else {
|
||||
fputc(c, stdout);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void php3_log_err(char *log_message)
|
||||
{
|
||||
@ -847,6 +853,7 @@ int php_module_startup(sapi_module_struct *sf)
|
||||
|
||||
PG(header_is_being_sent) = 0;
|
||||
SG(request_info).headers_only = 0;
|
||||
PG(connection_status) = PHP_CONNECTION_NORMAL;
|
||||
|
||||
#if HAVE_SETLOCALE
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
@ -324,6 +324,10 @@ PHPAPI int cfg_get_string(char *varname, char **result);
|
||||
#include "zend_variables.h"
|
||||
#include "zend_constants.h"
|
||||
|
||||
/* connection status states */
|
||||
#define PHP_CONNECTION_NORMAL 0
|
||||
#define PHP_CONNECTION_ABORTED 1
|
||||
#define PHP_CONNECTION_TIMEOUT 2
|
||||
|
||||
|
||||
/* Finding offsets of elements within structures.
|
||||
|
@ -83,6 +83,9 @@ struct _php_core_globals {
|
||||
|
||||
long y2k_compliance;
|
||||
|
||||
short connection_status;
|
||||
short ignore_user_abort;
|
||||
|
||||
unsigned char header_is_being_sent;
|
||||
|
||||
/* for fsock */
|
||||
|
13
mod_php4.c
13
mod_php4.c
@ -94,12 +94,17 @@ void php_save_umask()
|
||||
static int zend_apache_ub_write(const char *str, uint str_length)
|
||||
{
|
||||
SLS_FETCH();
|
||||
|
||||
int ret;
|
||||
|
||||
if (SG(server_context)) {
|
||||
return rwrite(str, str_length, (request_rec *) SG(server_context));
|
||||
ret = rwrite(str, str_length, (request_rec *) SG(server_context));
|
||||
} else {
|
||||
return fwrite(str, 1, str_length, stdout);
|
||||
ret = fwrite(str, 1, str_length, stdout);
|
||||
}
|
||||
if(ret != str_length) {
|
||||
PG(connection_status) = PHP_CONNECTION_ABORTED;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -466,7 +471,7 @@ int php_xbithack_handler(request_rec * r)
|
||||
return send_parsed_php(r);
|
||||
}
|
||||
|
||||
static void apache_php_module_shutdown_wrapper()
|
||||
static void apache_php_module_shutdown_wrapper(void)
|
||||
{
|
||||
apache_php_initialized = 0;
|
||||
sapi_module.shutdown(&sapi_module);
|
||||
|
Loading…
Reference in New Issue
Block a user