Sebastian Nohn wrote:
> Sebastian Nohn wrote:
> 
>>I'd like to propose these patches for inclusion:
>>
>> http://www.nohn.org/blog/uploads/servertokens_off.patch
>> http://www.nohn.org/blog/uploads/servertokens_off_documentation.patch
> 
> Patches are now attached by request.
> 
> I'm looking forward for your comments.

And now patches against trunk are available too (attached to this mail).

Best regards,
    Sebastian
Index: server/core.c
===================================================================
--- server/core.c       (revision 430809)
+++ server/core.c       (working copy)
@@ -2708,7 +2708,8 @@
     SrvTk_MINIMAL,      /* 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 */
+    SrvTk_PRODUCT_ONLY, /* eg: Apache */
+    SrvTk_OFF           /* eg: Nothing at all */
 };
 static enum server_token_type ap_server_tokens = SrvTk_FULL;
 
@@ -2763,7 +2764,10 @@
  */
 static void ap_set_version(apr_pool_t *pconf)
 {
-    if (ap_server_tokens == SrvTk_PRODUCT_ONLY) {
+    if (ap_server_tokens == SrvTk_OFF) {
+        ap_add_version_component(pconf, "");
+    }
+    else if (ap_server_tokens == SrvTk_PRODUCT_ONLY) {
         ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT);
     }
     else if (ap_server_tokens == SrvTk_MINIMAL) {
@@ -2812,6 +2816,9 @@
     else if (!strcasecmp(arg, "Prod") || !strcasecmp(arg, "ProductOnly")) {
         ap_server_tokens = SrvTk_PRODUCT_ONLY;
     }
+    else if (!strcasecmp(arg, "Off") ) {
+        ap_server_tokens = SrvTk_OFF;
+    }
     else {
         ap_server_tokens = SrvTk_FULL;
     }
Index: modules/http/http_filters.c
===================================================================
--- modules/http/http_filters.c (revision 430809)
+++ modules/http/http_filters.c (working copy)
@@ -737,7 +737,10 @@
         }
     }
     else {
-        form_header_field(&h, "Server", ap_get_server_version());
+        char *server_version = ap_get_server_version();
+        if (server_version[0] != '\0') {
+            form_header_field(&h, "Server", ap_get_server_version());
+        }
     }
 
     /* unset so we don't send them again */

Reply via email to