httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r808965 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/core.xml server/core.c
Date Fri, 28 Aug 2009 17:37:12 GMT
Author: jim
Date: Fri Aug 28 17:37:12 2009
New Revision: 808965

URL: http://svn.apache.org/viewvc?rev=808965&view=rev
Log:
And additional ServerTokens improvement...

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/core.xml
    httpd/httpd/trunk/server/core.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=808965&r1=808964&r2=808965&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Aug 28 17:37:12 2009
@@ -3,8 +3,9 @@
 Changes with Apache 2.3.3
 
   *) ServerTokens now accepts 'Off' which disables sending of
-     Server: header and sets SERVER_SOFTWARE to empty.
-     [Jim Jagielski]
+     Server: header and sets SERVER_SOFTWARE to empty. It also accepts
+     'Set' which allows the user to specify any string as the Server:
+     name.  [Jim Jagielski]
 
   *) mod_headers: generalise the envclause to support expression
      evaluation with ap_expr parser [Nick Kew]

Modified: httpd/httpd/trunk/docs/manual/mod/core.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/core.xml?rev=808965&r1=808964&r2=808965&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Fri Aug 28 17:37:12 2009
@@ -2903,6 +2903,14 @@
       <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41
       (Unix)</code></dd>
 
+      <dt><code>ServerTokens Set <em>"String"</em></code></dt>
+
+      <dd>Server sends user specified string
+      (<em>e.g.</em>): <code>Server: MyWebServer/8.6</code><br/>
+      <strong>Note:</strong> The string must be in quotes if
+      there are any embedded spaces.
+      </dd>
+
       <dt><code>ServerTokens Full</code> (or not specified)</dt>
 
       <dd>Server sends (<em>e.g.</em>): <code>Server: Apache/2.0.41

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=808965&r1=808964&r2=808965&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Fri Aug 28 17:37:12 2009
@@ -2677,6 +2677,7 @@
 static char *server_banner = NULL;
 static int banner_locked = 0;
 static char *server_description = NULL;
+static char *user_server_banner = NULL;
 
 enum server_token_type {
     SrvTk_MAJOR,         /* eg: Apache/2 */
@@ -2685,7 +2686,8 @@
     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 */
-    SrvTk_OFF            /* eg: <blank> */
+    SrvTk_OFF,           /* eg: <blank> */
+    SrvTk_SET
 };
 static enum server_token_type ap_server_tokens = SrvTk_FULL;
 
@@ -2749,7 +2751,10 @@
  */
 static void set_banner(apr_pool_t *pconf)
 {
-    if (ap_server_tokens == SrvTk_OFF) {
+    if (ap_server_tokens == SrvTk_SET) {
+        ap_add_version_component(pconf, user_server_banner);
+    }
+    else if (ap_server_tokens == SrvTk_OFF) {
         ap_add_version_component(pconf, "");
     }
     else if (ap_server_tokens == SrvTk_PRODUCT_ONLY) {
@@ -2779,7 +2784,7 @@
 }
 
 static const char *set_serv_tokens(cmd_parms *cmd, void *dummy,
-                                   const char *arg)
+                                   const char *arg1, const char *arg2)
 {
     const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
 
@@ -2787,22 +2792,26 @@
         return err;
     }
 
-    if (!strcasecmp(arg, "Off")) {
+    if (!strcasecmp(arg1, "Set")) {
+        ap_server_tokens = SrvTk_SET;
+        user_server_banner = (arg2 ? apr_pstrdup(cmd->pool, arg2) : "");
+    }
+    else if (!strcasecmp(arg1, "Off")) {
         ap_server_tokens = SrvTk_OFF;
     }
-    else if (!strcasecmp(arg, "OS")) {
+    else if (!strcasecmp(arg1, "OS")) {
         ap_server_tokens = SrvTk_OS;
     }
-    else if (!strcasecmp(arg, "Min") || !strcasecmp(arg, "Minimal")) {
+    else if (!strcasecmp(arg1, "Min") || !strcasecmp(arg1, "Minimal")) {
         ap_server_tokens = SrvTk_MINIMAL;
     }
-    else if (!strcasecmp(arg, "Major")) {
+    else if (!strcasecmp(arg1, "Major")) {
         ap_server_tokens = SrvTk_MAJOR;
     }
-    else if (!strcasecmp(arg, "Minor") ) {
+    else if (!strcasecmp(arg1, "Minor") ) {
         ap_server_tokens = SrvTk_MINOR;
     }
-    else if (!strcasecmp(arg, "Prod") || !strcasecmp(arg, "ProductOnly")) {
+    else if (!strcasecmp(arg1, "Prod") || !strcasecmp(arg1, "ProductOnly")) {
         ap_server_tokens = SrvTk_PRODUCT_ONLY;
     }
     else {
@@ -3310,8 +3319,9 @@
   "Level of verbosity in error logging"),
 AP_INIT_TAKE1("NameVirtualHost", ap_set_name_virtual_host, NULL, RSRC_CONF,
   "A numeric IP address:port, or the name of a host"),
-AP_INIT_TAKE1("ServerTokens", set_serv_tokens, NULL, RSRC_CONF,
-  "Determine tokens displayed in the Server: header - Min(imal), Major, Minor, Prod, OS,
Off or Full"),
+AP_INIT_TAKE12("ServerTokens", set_serv_tokens, NULL, RSRC_CONF,
+  "Determine tokens displayed in the Server: header - Min(imal), "
+  "Major, Minor, Prod, OS, Off, Set or Full"),
 AP_INIT_TAKE1("LimitRequestLine", set_limit_req_line, NULL, RSRC_CONF,
   "Limit on maximum size of an HTTP request line"),
 AP_INIT_TAKE1("LimitRequestFieldsize", set_limit_req_fieldsize, NULL,



Mime
View raw message