cvs: /php3 main.c mod_php3.c mod_php3.h php3.ini-dist
| From: | Zeev Suraski | Date: | Fri, 03 Dec 1999 13:40:39 +0000 |
| Subject: | cvs: /php3 main.c mod_php3.c mod_php3.h php3.ini-dist | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-13401@lists.php.net to get a copy of this message | ||
zeev Fri Dec 3 08:40:39 1999 EDT
Modified files:
/php3 main.c mod_php3.c mod_php3.h php3.ini-dist
Log:
Add expose_php support for PHP 3.0.
Since I don't remember whether the INI file is already read by the time
the Server: addition is registered, it currently doesn't affect it.
I'm not sure whether expose_php should default to 1 or 0 in PHP 3.0. If it
defaults to 1, we must put a big notice about it in the release notes.
Index: php3/main.c
diff -u php3/main.c:1.506 php3/main.c:1.507
--- php3/main.c:1.506 Fri Dec 3 07:36:24 1999
+++ php3/main.c Fri Dec 3 08:40:38 1999
@@ -29,7 +29,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.506 1999/12/03 12:36:24 sas Exp $ */
+/* $Id: main.c,v 1.507 1999/12/03 13:40:38 zeev Exp $ */
/* #define CRASH_DETECTION */
@@ -1129,6 +1129,9 @@
if (cfg_get_long("xbithack", &php3_ini.xbithack) == FAILURE) {
php3_ini.xbithack = 0;
}
+ if (cfg_get_long("expose_php", &php3_ini.expose_php) == FAILURE) {
+ php3_ini.expose_php = 1;
+ }
if (cfg_get_string("browscap", &php3_ini.browscap) == FAILURE) {
php3_ini.browscap = NULL;
}
@@ -1771,7 +1774,9 @@
GLOBAL(php3_preprocess) = _cgi_preprocess;
display_source_mode = _cgi_display_source_mode;
- PUTS("X-Powered-By: PHP/" PHP_VERSION "\r\n");
+ if (php3_ini.expose_php) {
+ PUTS("X-Powered-By: PHP/" PHP_VERSION "\r\n");
+ }
php3_TreatHeaders();
Index: php3/mod_php3.c
diff -u php3/mod_php3.c:1.94 php3/mod_php3.c:1.95
--- php3/mod_php3.c:1.94 Fri Dec 3 07:36:25 1999
+++ php3/mod_php3.c Fri Dec 3 08:40:38 1999
@@ -27,7 +27,7 @@
| (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php3.c,v 1.94 1999/12/03 12:36:25 sas Exp $ */
+/* $Id: mod_php3.c,v 1.95 1999/12/03 13:40:38 zeev Exp $ */
#ifdef THREAD_SAFE
#include "tls.h"
@@ -242,7 +242,9 @@
chdir_file(filename);
add_common_vars(r);
add_cgi_vars(r);
- table_add(r->headers_out, "X-Powered-By", "PHP/" PHP_VERSION);
+ if (php3_ini.expose_php) {
+ table_add(r->headers_out, "X-Powered-By", "PHP/" PHP_VERSION);
+ }
apache_php3_module_main(r, fd, display_source_mode, preprocessed);
/* Done, restore umask, turn off timeout, close file and return */
@@ -331,6 +333,7 @@
/* skip the highlight stuff */
if (add->sql_safe_mode != base->sql_safe_mode) new->sql_safe_mode =
add->sql_safe_mode;
if (add->xbithack != base->xbithack) new->xbithack = add->xbithack;
+ if (add->expose_php != base->expose_php) new->expose_php = add->expose_php;
if (add->engine != base->engine) new->engine = add->engine;
if (add->last_modified != base->last_modified) new->last_modified =
add->last_modified;
if (add->max_execution_time != base->max_execution_time) new->max_execution_time =
add->max_execution_time;
@@ -417,6 +420,9 @@
case 15:
conf->ignore_user_abort = val;
break;
+ case 16:
+ conf->expose_php = val;
+ break;
}
return NULL;
}
@@ -632,6 +638,7 @@
{"php3_enable_dl", php3flaghandler, (void *)13, RSRC_CONF|ACCESS_CONF, FLAG,
"on|off"},
{"php3_asp_tags", php3flaghandler, (void *)14, OR_OPTIONS, FLAG, "on|off"},
{"php3_ignore_user_abort", php3flaghandler, (void *)13, RSRC_CONF|ACCESS_CONF, FLAG,
"on|off"},
+ {"php3_expose_php", php3flaghandler, (void *)15, RSRC_CONF|ACCESS_CONF, FLAG,
"on|off"},
{NULL}
};
Index: php3/mod_php3.h
diff -u php3/mod_php3.h:1.51 php3/mod_php3.h:1.52
--- php3/mod_php3.h:1.51 Wed Jan 27 16:55:47 1999
+++ php3/mod_php3.h Fri Dec 3 08:40:38 1999
@@ -26,7 +26,7 @@
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
+----------------------------------------------------------------------+
*/
-/* $Id: mod_php3.h,v 1.51 1999/01/27 21:55:47 rasmus Exp $ */
+/* $Id: mod_php3.h,v 1.52 1999/12/03 13:40:38 zeev Exp $ */
#ifndef _MOD_PHP3_H
#define _MOD_PHP3_H
@@ -92,6 +92,7 @@
long enable_dl;
long ignore_user_abort;
char *dav_script;
+ long expose_php;
} php3_ini_structure;
#if MSVC5
Index: php3/php3.ini-dist
diff -u php3/php3.ini-dist:1.54 php3/php3.ini-dist:1.55
--- php3/php3.ini-dist:1.54 Fri Jul 16 23:34:19 1999
+++ php3/php3.ini-dist Fri Dec 3 08:40:38 1999
@@ -50,6 +50,12 @@
highlight.html = #000000
+expose_php = On ; Decides whether PHP may expose the fact that it is installed on the
+ ; server (e.g., by adding its signature to the Web server header).
+ ; It is no security threat in any way, but it makes it possible
+ ; to determine whether you use PHP on your server or not.
+
+
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;