httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r808895 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/core.xml modules/http/http_filters.c modules/proxy/mod_proxy_connect.c modules/proxy/mod_proxy_ftp.c server/core.c server/mpm_unix.c
Date Fri, 28 Aug 2009 14:31:01 GMT
Author: jim
Date: Fri Aug 28 14:31:00 2009
New Revision: 808895

URL: http://svn.apache.org/viewvc?rev=808895&view=rev
Log:
OK, might as well finish this... Allow ServerTokens Off

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/core.xml
    httpd/httpd/trunk/modules/http/http_filters.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c
    httpd/httpd/trunk/server/core.c
    httpd/httpd/trunk/server/mpm_unix.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=808895&r1=808894&r2=808895&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Aug 28 14:31:00 2009
@@ -2,6 +2,10 @@
 
 Changes with Apache 2.3.3
 
+  *) ServerTokens now accepts 'Off' which disables sending of
+     Server: header and sets SERVER_SOFTWARE to empty.
+     [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=808895&r1=808894&r2=808895&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/core.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/core.xml Fri Aug 28 14:31:00 2009
@@ -2873,6 +2873,11 @@
     information about compiled-in modules.</p>
 
     <dl>
+      <dt><code>ServerTokens Off</code></dt>
+
+      <dd>Server sends no <code>Server:</code> header
+      (and <code>SERVER_SOFTWARE</code> is blank)</dd>
+
       <dt><code>ServerTokens Prod[uctOnly]</code></dt>
 
       <dd>Server sends (<em>e.g.</em>): <code>Server:

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?rev=808895&r1=808894&r2=808895&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Fri Aug 28 14:31:00 2009
@@ -874,6 +874,7 @@
 {
     char *date;
     const char *server;
+    const char *us = ap_get_server_banner();
     header_struct h;
     struct iovec vec[4];
 
@@ -930,19 +931,25 @@
         if (server) {
             form_header_field(&h, "Server", server);
         } else {
-            form_header_field(&h, "Server", ap_get_server_banner());
+            if (*us) {
+                form_header_field(&h, "Server", ap_get_server_banner());
+            }
         }
     }
     else {
         date = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
         ap_recent_rfc822_date(date, r->request_time);
         form_header_field(&h, "Date", date);
-        form_header_field(&h, "Server", ap_get_server_banner());
+        if (*us) {
+            form_header_field(&h, "Server", ap_get_server_banner());
+        }
     }
 
     /* unset so we don't send them again */
     apr_table_unset(r->headers_out, "Date");        /* Avoid bogosity */
-    apr_table_unset(r->headers_out, "Server");
+    if (*us) {
+        apr_table_unset(r->headers_out, "Server");
+    }
 }
 
 AP_DECLARE(void) ap_basic_http_header(request_rec *r, apr_bucket_brigade *bb)

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c?rev=808895&r1=808894&r2=808895&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_connect.c Fri Aug 28 14:31:00 2009
@@ -229,7 +229,7 @@
                   "CONNECT %s HTTP/1.0" CRLF, r->uri);
         apr_socket_send(sock, buffer, &nbytes);
         nbytes = apr_snprintf(buffer, sizeof(buffer),
-                  "Proxy-agent: %s" CRLF CRLF, ap_get_server_banner());
+                  "Proxy-agent: %s" CRLF CRLF, ap_get_server_description());
         apr_socket_send(sock, buffer, &nbytes);
     }
     else {

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c?rev=808895&r1=808894&r2=808895&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_ftp.c Fri Aug 28 14:31:00 2009
@@ -1774,7 +1774,7 @@
 
     apr_rfc822_date(dates, r->request_time);
     apr_table_setn(r->headers_out, "Date", dates);
-    apr_table_setn(r->headers_out, "Server", ap_get_server_banner());
+    apr_table_setn(r->headers_out, "Server", ap_get_server_description());
 
     /* set content-type */
     if (dirlisting) {

Modified: httpd/httpd/trunk/server/core.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core.c?rev=808895&r1=808894&r2=808895&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core.c (original)
+++ httpd/httpd/trunk/server/core.c Fri Aug 28 14:31:00 2009
@@ -2679,12 +2679,13 @@
 static char *server_description = NULL;
 
 enum server_token_type {
-    SrvTk_MAJOR,        /* eg: Apache/2 */
-    SrvTk_MINOR,        /* eg. Apache/2.0 */
-    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_MAJOR,         /* eg: Apache/2 */
+    SrvTk_MINOR,         /* eg. Apache/2.0 */
+    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_OFF            /* eg: <blank> */
 };
 static enum server_token_type ap_server_tokens = SrvTk_FULL;
 
@@ -2748,7 +2749,10 @@
  */
 static void set_banner(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) {
@@ -2783,7 +2787,10 @@
         return err;
     }
 
-    if (!strcasecmp(arg, "OS")) {
+    if (!strcasecmp(arg, "Off")) {
+        ap_server_tokens = SrvTk_OFF;
+    }
+    else if (!strcasecmp(arg, "OS")) {
         ap_server_tokens = SrvTk_OS;
     }
     else if (!strcasecmp(arg, "Min") || !strcasecmp(arg, "Minimal")) {
@@ -3304,7 +3311,7 @@
 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), OS or Full"),
+  "Determine tokens displayed in the Server: header - Min(imal), Major, Minor, Prod, OS,
Off 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,

Modified: httpd/httpd/trunk/server/mpm_unix.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm_unix.c?rev=808895&r1=808894&r2=808895&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm_unix.c (original)
+++ httpd/httpd/trunk/server/mpm_unix.c Fri Aug 28 14:31:00 2009
@@ -553,7 +553,7 @@
      * requests in their logs.
      */
     srequest = apr_pstrcat(p, "OPTIONS * HTTP/1.0\r\nUser-Agent: ",
-                           ap_get_server_banner(),
+                           ap_get_server_description(),
                            " (internal dummy connection)\r\n\r\n", NULL);
 
     /* Since some operating systems support buffering of data or entire



Mime
View raw message