summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/SAPI.c6
-rw-r--r--main/SAPI.h3
-rw-r--r--main/main.c26
3 files changed, 10 insertions, 25 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 2da12e5b83..54de23facf 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -192,6 +192,9 @@ SAPI_API void sapi_activate(SLS_D)
}
SG(request_info).cookie_data = sapi_module.read_cookies(SLS_C);
}
+ if (sapi_module.activate) {
+ sapi_module.activate(SLS_C);
+ }
}
@@ -201,6 +204,9 @@ SAPI_API void sapi_deactivate(SLS_D)
if (SG(request_info).post_data) {
efree(SG(request_info).post_data);
}
+ if (sapi_module.deactivate) {
+ sapi_module.deactivate(SLS_C);
+ }
}
static int sapi_extract_response_code(const char *header_line)
diff --git a/main/SAPI.h b/main/SAPI.h
index 60fc8efc6d..625d5d9919 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -135,6 +135,9 @@ struct _sapi_module_struct {
int (*startup)(struct _sapi_module_struct *sapi_module);
int (*shutdown)(struct _sapi_module_struct *sapi_module);
+ int (*activate)(SLS_D);
+ int (*deactivate)(SLS_D);
+
int (*ub_write)(const char *str, unsigned int str_length);
void (*flush)(void *server_context);
diff --git a/main/main.c b/main/main.c
index 3df5d5e5dc..329533de33 100644
--- a/main/main.c
+++ b/main/main.c
@@ -623,24 +623,8 @@ int php_request_startup(CLS_D ELS_DC PLS_DC SLS_DC)
php_output_startup();
-#if APACHE
- /*
- * For the Apache module version, this bit of code registers a cleanup
- * function that gets triggered when our request pool is destroyed.
- * We need this because at any point in our code we can be interrupted
- * and that may happen before we have had time to free our memory.
- * The php_request_shutdown function needs to free all outstanding allocated
- * memory.
- */
- block_alarms();
- register_cleanup(((request_rec *) SG(server_context))->pool, NULL, php_request_shutdown, php_request_shutdown_for_exec);
- unblock_alarms();
-#endif
-
/* initialize global variables */
- {
- PG(header_is_being_sent)=0;
- }
+ PG(header_is_being_sent)=0;
if (php_init_request_info(NULL)) {
php_printf("Unable to initialize request info.\n");
@@ -694,14 +678,6 @@ void php_request_shutdown(void *dummy)
shutdown_memory_manager(CG(unclean_shutdown), 0);
php_unset_timeout();
-#if CGI_BINARY
- fflush(stdout);
- if(request_info.php_argv0) {
- free(request_info.php_argv0);
- request_info.php_argv0 = NULL;
- }
-#endif
-
global_unlock();
}