cvs: /php4/sapi/aolserver aolserver.c
| From: | Sascha Schumann | Date: | Mon, 13 Dec 1999 16:46:25 +0000 |
| Subject: | cvs: /php4/sapi/aolserver aolserver.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-7857@lists.php.net to get a copy of this message | ||
sas Mon Dec 13 11:46:25 1999 EDT
Modified files:
/php4/sapi/aolserver aolserver.c
Log:
Reapply configuration for each request
Index: php4/sapi/aolserver/aolserver.c
diff -u php4/sapi/aolserver/aolserver.c:1.22 php4/sapi/aolserver/aolserver.c:1.23
--- php4/sapi/aolserver/aolserver.c:1.22 Mon Dec 13 11:23:57 1999
+++ php4/sapi/aolserver/aolserver.c Mon Dec 13 11:45:54 1999
@@ -22,7 +22,7 @@
* - CGI/1.1 conformance
*/
-/* $Id: aolserver.c,v 1.22 1999/12/13 16:23:57 sas Exp $ */
+/* $Id: aolserver.c,v 1.23 1999/12/13 16:45:54 sas Exp $ */
/* conflict between PHP and AOLserver headers */
#define Debug php_Debug
@@ -59,10 +59,6 @@
#define NSG(v) (ns_context->v)
#define NSLS_FETCH() ns_globals_struct *ns_context = ts_resource(ns_globals_id)
-/* TSRM id */
-
-static int ns_globals_id;
-
/* php_ns_context is per-server (thus only once at all) */
typedef struct {
@@ -78,6 +74,16 @@
size_t data_avail;
} ns_globals_struct;
+/* TSRM id */
+
+static int ns_globals_id;
+
+/* global context */
+
+static php_ns_context *global_context;
+
+static void php_ns_config(php_ns_context *ctx, char global);
+
/*
* php_ns_sapi_ub_write() writes data to the client connection.
*/
@@ -200,7 +206,7 @@
NSLS_FETCH();
PUTS("<table border=5 width=600>\n");
- php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.22
1999/12/13 16:23:57 sas Exp $");
+ php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.23
1999/12/13 16:45:54 sas Exp $");
php_info_print_table_row(2, "Build date", Ns_InfoBuildDate());
php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile());
php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog());
@@ -412,9 +418,11 @@
file_handle.filename = SG(request_info).path_translated;
file_handle.free_filename = 0;
+ php_ns_config(global_context, 0);
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC) == FAILURE) {
return NS_ERROR;
}
+
php_ns_hash_environment(NSLS_C CLS_CC ELS_CC PLS_CC SLS_CC);
php_execute_script(&file_handle CLS_CC ELS_CC PLS_CC);
php_request_shutdown(NULL);
@@ -510,7 +518,7 @@
*/
static void
-php_ns_config(php_ns_context *ctx)
+php_ns_config(php_ns_context *ctx, char global)
{
int i;
char *path;
@@ -519,20 +527,20 @@
path = Ns_ConfigGetPath(ctx->ns_server, ctx->ns_module, NULL);
set = Ns_ConfigGetSection(path);
- for(i = 0; set && i < Ns_SetSize(set); i++) {
+ for (i = 0; set && i < Ns_SetSize(set); i++) {
char *key = Ns_SetKey(set, i);
char *value = Ns_SetValue(set, i);
- if(!strcasecmp(key, "map")) {
+ if (global && !strcasecmp(key, "map")) {
Ns_Log(Notice, "Registering PHP for \"%s\"", value);
Ns_RegisterRequest(ctx->ns_server, "GET", value, php_ns_request_handler, NULL, ctx,
0);
Ns_RegisterRequest(ctx->ns_server, "POST", value, php_ns_request_handler, NULL,
ctx, 0);
Ns_RegisterRequest(ctx->ns_server, "HEAD", value, php_ns_request_handler, NULL,
ctx, 0);
- } else if(!strcasecmp(key, "php_value")) {
+ } else if (!global && !strcasecmp(key, "php_value")) {
char *val;
val = strchr(value, ' ');
- if(val) {
+ if (val) {
char *new_key;
new_key = estrndup(value, val - value);
@@ -598,7 +606,9 @@
ctx->ns_module = strdup(module);
/* read the configuration */
- php_ns_config(ctx);
+ php_ns_config(ctx, 1);
+
+ global_context = ctx;
/* register shutdown handler */
Ns_RegisterServerShutdown(server, php_ns_server_shutdown, ctx);