From: Uwe Schindler Date: Wed, 23 Jun 2004 13:05:12 +0000 (+0000) Subject: Addendum to bug #28878: change ini keys as PHP_INI_SYSTEM X-Git-Tag: php-4.3.9RC1~81 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aed8e184158814a03272838ae7175a33833d5ec6;p=php Addendum to bug #28878: change ini keys as PHP_INI_SYSTEM Also: Adding "bucket" parameter to non-ini-keys, Elemination of double CONTENT_TYPE/_LENGTH environment variables --- diff --git a/NEWS b/NEWS index b0271fe524..8d66052d58 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2004, Version 4.3.8 - Updated PCRE to provide better error handling in certain cases. (Andrei) +- NSAPI: added "bucket" parameter to list of non-php.ini-keys of php4_execute + for doing performance stats without warnings in server-log. (Uwe Schindler) - Fixed bug #28868 (Internal wrapper registry not thread safe). (Sara) - Fixed bug #28818 (Apache 2 sapis do not export st_dev). (xuefer at 21cn dot com, Ilia). diff --git a/sapi/nsapi/nsapi.c b/sapi/nsapi/nsapi.c index 8604b16766..849317be31 100644 --- a/sapi/nsapi/nsapi.c +++ b/sapi/nsapi/nsapi.c @@ -105,12 +105,6 @@ typedef struct nsapi_equiv { const char *nsapi_eq; } nsapi_equiv; -static nsapi_equiv nsapi_headers[] = { - { "CONTENT_LENGTH", "content-length" }, - { "CONTENT_TYPE", "content-type" } -}; -static size_t nsapi_headers_size = sizeof(nsapi_headers)/sizeof(nsapi_headers[0]); - static nsapi_equiv nsapi_reqpb[] = { { "QUERY_STRING", "query" }, { "REQUEST_LINE", "clf-request" }, @@ -136,7 +130,7 @@ static nsapi_equiv nsapi_client[] = { static size_t nsapi_client_size = sizeof(nsapi_client)/sizeof(nsapi_client[0]); /* this parameters to "Service"/"Error" are NSAPI ones which should not be php.ini keys and are excluded */ -static char *nsapi_exclude_from_ini_entries[] = { "fn", "type", "method", "directive", "code", "reason", "script", NULL }; +static char *nsapi_exclude_from_ini_entries[] = { "fn", "type", "method", "directive", "code", "reason", "script", "bucket", NULL }; static char *nsapi_strdup(char *str) { @@ -605,20 +599,19 @@ static void sapi_nsapi_register_server_variables(zval *track_vars_array TSRMLS_D } } - for (i = 0; i < nsapi_headers_size; i++) { - value = pblock_findval(nsapi_headers[i].nsapi_eq, rc->rq->headers); - if (value) { - php_register_variable((char *)nsapi_headers[i].env_var, value, track_vars_array TSRMLS_CC); - } - } - for (i=0; i < rc->rq->headers->hsize; i++) { entry=rc->rq->headers->ht[i]; while (entry) { if (!PG(safe_mode) || strncasecmp(entry->param->name, "authorization", 13)) { - snprintf(buf, NS_BUF_SIZE, "HTTP_%s", entry->param->name); + if (strcasecmp(entry->param->name, "content-length")==0 || strcasecmp(entry->param->name, "content-type")==0) { + strncpy(buf, entry->param->name, NS_BUF_SIZE); + pos = 0; + } else { + snprintf(buf, NS_BUF_SIZE, "HTTP_%s", entry->param->name); + pos = 5; + } buf[NS_BUF_SIZE]='\0'; - for(p = buf + 5; *p; p++) { + for(p = buf + pos; *p; p++) { *p = toupper(*p); if (*p < 'A' || *p > 'Z') { *p = '_'; @@ -777,7 +770,7 @@ static void nsapi_php_ini_entries(NSLS_D TSRMLS_DC) /* 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) { + PHP_INI_SYSTEM, PHP_INI_STAGE_RUNTIME)==FAILURE) { 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); } }