thetaphi                Mon Jul 21 10:20:31 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/sapi/nsapi nsapi.c 
  Log:
  some code cleanups
  
Index: php-src/sapi/nsapi/nsapi.c
diff -u php-src/sapi/nsapi/nsapi.c:1.28.2.17 php-src/sapi/nsapi/nsapi.c:1.28.2.18
--- php-src/sapi/nsapi/nsapi.c:1.28.2.17        Tue Jul 15 18:19:23 2003
+++ php-src/sapi/nsapi/nsapi.c  Mon Jul 21 10:20:30 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: nsapi.c,v 1.28.2.17 2003/07/15 22:19:23 thetaphi Exp $ */
+/* $Id: nsapi.c,v 1.28.2.18 2003/07/21 14:20:30 thetaphi Exp $ */
 
 /*
  * PHP includes
@@ -134,6 +134,8 @@
 };
 static size_t nsapi_client_size = sizeof(nsapi_client)/sizeof(nsapi_client[0]);
 
+static char *nsapi_exclude_from_ini_entries[] = { "fn", "type", "method", 
"directive", NULL };
+
 static char *nsapi_strdup(char *str)
 {
        if (str != NULL) {
@@ -204,7 +206,7 @@
        NULL,
        NULL,
        PHP_MINFO(nsapi),
-       "$Revision: 1.28.2.17 $",
+       "$Revision: 1.28.2.18 $",
        STANDARD_MODULE_PROPERTIES
 };
 /* }}} */
@@ -229,7 +231,7 @@
  * servact_* functions are always in the newest one, older ones are supported by
  * the server only by wrapping the function table nothing else. So choose
  * the newest one found in process space for dynamic linking */
-char *nsapi_dlls[] = { "ns-httpd40.dll", "ns-httpd36.dll", "ns-httpd35.dll", 
"ns-httpd30.dll", NULL };
+static char *nsapi_dlls[] = { "ns-httpd40.dll", "ns-httpd36.dll", "ns-httpd35.dll", 
"ns-httpd30.dll", NULL };
 #endif
 
 /* {{{ php_nsapi_init_dynamic_symbols
@@ -696,7 +698,7 @@
        TSRMLS_FETCH();
        nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
 
-       log_error(LOG_INFORM, "PHP module", rc->sn, rc->rq, "%s", message);
+       log_error(LOG_INFORM, pblock_findval("fn", rc->pb), rc->sn, rc->rq, "%s", 
message);
 }
 
 static int php_nsapi_startup(sapi_module_struct *sapi_module)
@@ -744,19 +746,23 @@
 static void nsapi_php_ini_entries(NSLS_D TSRMLS_DC)
 {
        struct pb_entry *entry;
-       register int i;
+       register int i,j,ok;
 
        for (i=0; i < NSG(pb)->hsize; i++) {
                entry=NSG(pb)->ht[i];
                while (entry) {
                        /* exclude standard entries given to "Service" which should 
not go into ini entries */
-                       if (strcasecmp(entry->param->name,"fn") && 
strcasecmp(entry->param->name,"type")
-                        && strcasecmp(entry->param->name,"method")  && 
strcasecmp(entry->param->name,"directive")) {
+                       ok=1;
+                       for (j=0; nsapi_exclude_from_ini_entries[j]; j++) {
+                               ok&=(!strcasecmp(entry->param->name, 
nsapi_exclude_from_ini_entries[j]));
+                       }
+
+                       if (ok) {
                                /* change the ini entry */
                                if (zend_alter_ini_entry(entry->param->name, 
strlen(entry->param->name)+1,
                                 entry->param->value, strlen(entry->param->value),
                                 PHP_INI_USER, PHP_INI_STAGE_RUNTIME)==FAILURE) {
-                                       log_error(LOG_WARN, "php4_execute", NSG(sn), 
NSG(rq), "Cannot change php.ini key \"%s\" to \"%s\"", entry->param->name, 
entry->param->value);
+                                       log_error(LOG_WARN, pblock_findval("fn", 
NSG(pb)), NSG(sn), NSG(rq), "Cannot change php.ini key \"%s\" to \"%s\"", 
entry->param->name, entry->param->value);
                                }
                        }
                        entry=entry->next;
@@ -807,7 +813,7 @@
 
        daemon_atrestart(&php4_close, NULL);
 
-       log_error(LOG_INFORM, "php4_init", sn, rq, "Initialized PHP Module (%d threads 
exspected)", threads);
+       log_error(LOG_INFORM, pblock_findval("fn", pb), sn, rq, "Initialized PHP 
Module (%d threads exspected)", threads);
        return REQ_PROCEED;
 }
 
@@ -832,7 +838,7 @@
           by looking for a request context in the current thread */
        if (SG(server_context)) {
                /* send 500 internal server error */
-               log_error(LOG_WARN, "php4_execute", sn, rq, "Cannot make nesting PHP 
requests with nsapi_virtual()");
+               log_error(LOG_WARN, pblock_findval("fn", pb), sn, rq, "Cannot make 
nesting PHP requests with nsapi_virtual()");
                protocol_status(sn, rq, 500, NULL);
                return REQ_ABORTED;
        }
@@ -866,13 +872,13 @@
                        retval=REQ_PROCEED;
                } else {
                        /* send 500 internal server error */
-                       log_error(LOG_WARN, "php4_execute", sn, rq, "Cannot prepare 
PHP engine!");
+                       log_error(LOG_WARN, pblock_findval("fn", pb), sn, rq, "Cannot 
prepare PHP engine!");
                        protocol_status(sn, rq, 500, NULL);
                        retval=REQ_ABORTED;
                }
        } else {
                /* send 404 because file not found */
-               log_error(LOG_WARN, "php4_execute", sn, rq, "Cannot execute PHP 
script: %s", SG(request_info).path_translated);
+               log_error(LOG_WARN, pblock_findval("fn", pb), sn, rq, "Cannot execute 
PHP script: %s", SG(request_info).path_translated);
                protocol_status(sn, rq, 404, NULL);
                retval=REQ_ABORTED;
        }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to