From: Ian Holsman Date: Fri, 23 Aug 2002 17:24:39 +0000 (+0000) Subject: new option to ServerTokens. "Maj[or]" which displays a server response X-Git-Tag: AGB_BEFORE_AAA_CHANGES~183 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df6a0c3e94e2ac58fad609109616b278655a6bbc;p=apache new option to ServerTokens. "Maj[or]" which displays a server response similar to Apache/2.0 Also surfaced the directive in the standard config, defaulting to FULL git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96500 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index b9905b6f7d..8c2b0f40ac 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.41 + *) New option to ServerTokens 'maj[or]'. Only show the major version + Also Surfaced this directive in the standard config (default FULL) + [Ian Holsman] + *) Change mod_rewrite to use apr-util's dbm support for dbm rewrite maps. The dbm type (e.g., ndbm, gdbm) can be specified on the RewriteMap directive. PR 10644 [Jeff Trawick] diff --git a/docs/conf/httpd-std.conf.in b/docs/conf/httpd-std.conf.in index ef2ab12486..07759c0952 100644 --- a/docs/conf/httpd-std.conf.in +++ b/docs/conf/httpd-std.conf.in @@ -501,6 +501,14 @@ CustomLog @rel_logfiledir@/access_log common # #CustomLog @rel_logfiledir@/access_log combined +# +# ServerTokens +# This directive configures what you return as the Server HTTP response +# Header. The default is 'Full' which sends information about the OS-Type +# and compiled in modules. +# Set to one of: Full | OS | Minor | Major | Prod +# where Full conveys the most information, and Prod the least. +ServerTokens Full # # Optionally add a line containing the server version and virtual host # name to server-generated pages (internal error documents, FTP directory diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml index aab92b30a1..fde44b525b 100644 --- a/docs/manual/mod/core.xml +++ b/docs/manual/mod/core.xml @@ -2288,7 +2288,7 @@ is accessed by an incompatible browser ServerTokens Configures the Server HTTP response header -ServerTokens Minimal|ProductOnly|OS|Full +ServerTokens Major|Minimal|ProductOnly|OS|Full ServerTokens Full server config @@ -2304,20 +2304,25 @@ is accessed by an incompatible browser
Server sends (e.g.): Server: Apache
+
ServerTokens Maj[or]
+ +
Server sends (e.g.): Server: + Apache/2.0
+
ServerTokens Min[imal]
Server sends (e.g.): Server: - Apache/1.3.0
+ Apache/2.0.41
ServerTokens OS
-
Server sends (e.g.): Server: Apache/1.3.0 +
Server sends (e.g.): Server: Apache/2.0.41 (Unix)
ServerTokens Full (or not specified)
-
Server sends (e.g.): Server: Apache/1.3.0 - (Unix) PHP/3.0 MyMod/1.2
+
Server sends (e.g.): Server: Apache/2.0.41 + (Unix) PHP/4.2.2 MyMod/1.2

This setting applies to the entire server, and cannot be diff --git a/include/ap_release.h b/include/ap_release.h index 35783f733a..ec599a1b65 100644 --- a/include/ap_release.h +++ b/include/ap_release.h @@ -73,7 +73,9 @@ */ #define AP_SERVER_BASEVENDOR "Apache Software Foundation" #define AP_SERVER_BASEPRODUCT "Apache" -#define AP_SERVER_BASEREVISION "2.0.41-dev" +#define AP_SERVER_MAJORVERSION "2.0" +#define AP_SERVER_MINORVERSION "41-dev" +#define AP_SERVER_BASEREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION #define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION #define AP_SERVER_VERSION AP_SERVER_BASEVERSION diff --git a/server/core.c b/server/core.c index ad68dda1c4..124888acef 100644 --- a/server/core.c +++ b/server/core.c @@ -2286,9 +2286,10 @@ static char *server_version = NULL; static int version_locked = 0; enum server_token_type { - SrvTk_MIN, /* eg: Apache/1.3.0 */ - SrvTk_OS, /* eg: Apache/1.3.0 (UNIX) */ - SrvTk_FULL, /* eg: Apache/1.3.0 (UNIX) PHP/3.0 FooBar/1.2b */ + SrvTk_MAJ, /* eg: Apache/2.0 */ + SrvTk_MIN, /* eg: Apache/2.0.41 */ + SrvTk_OS, /* eg: Apache/2.0.41 (UNIX) */ + SrvTk_FULL, /* eg: Apache/2.0.41 (UNIX) PHP/4.2.2 FooBar/1.2b */ SrvTk_PRODUCT_ONLY /* eg: Apache */ }; static enum server_token_type ap_server_tokens = SrvTk_FULL; @@ -2342,6 +2343,9 @@ static void ap_set_version(apr_pool_t *pconf) else if (ap_server_tokens == SrvTk_MIN) { ap_add_version_component(pconf, AP_SERVER_BASEVERSION); } + else if (ap_server_tokens == SrvTk_MAJ) { + ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT "/" AP_SERVER_MAJORVERSION); + } else { ap_add_version_component(pconf, AP_SERVER_BASEVERSION " (" PLATFORM ")"); } @@ -2370,6 +2374,9 @@ static const char *set_serv_tokens(cmd_parms *cmd, void *dummy, else if (!strcasecmp(arg, "Min") || !strcasecmp(arg, "Minimal")) { ap_server_tokens = SrvTk_MIN; } + else if (!strcasecmp(arg, "Maj") || !strcasecmp(arg, "Major")) { + ap_server_tokens = SrvTk_MAJ; + } else if (!strcasecmp(arg, "Prod") || !strcasecmp(arg, "ProductOnly")) { ap_server_tokens = SrvTk_PRODUCT_ONLY; }