]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
This patch adds the capability to suppress the version information in
authorserassio <>
Sun, 1 May 2005 14:11:47 +0000 (14:11 +0000)
committerserassio <>
Sun, 1 May 2005 14:11:47 +0000 (14:11 +0000)
the HTTP server headers and in the HTML error pages.

New squid.conf directive:

httpd_suppress_version_string on | off (default on)

Based on contribution from Nathan R. Valentine (thanks !!!)

src/HttpReply.cc
src/cache_cf.cc
src/cf.data.pre
src/errorpage.cc
src/ftp.cc
src/globals.h
src/gopher.cc
src/structs.h

index ad557ca99542bf45973467aeae3b8c2bec7dd01b..dce639413da0d9f4278ab3ef216e449490e663e0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: HttpReply.cc,v 1.70 2004/12/21 17:52:53 robertc Exp $
+ * $Id: HttpReply.cc,v 1.71 2005/05/01 08:11:47 serassio Exp $
  *
  * DEBUG: section 58    HTTP Reply (Response)
  * AUTHOR: Alex Rousskov
@@ -273,7 +273,7 @@ httpReplySetHeaders(HttpReply * reply, HttpVersion ver, http_status status, cons
     assert(reply);
     httpStatusLineSet(&reply->sline, ver, status, reason);
     hdr = &reply->header;
-    httpHeaderPutStr(hdr, HDR_SERVER, full_appname_string);
+    httpHeaderPutStr(hdr, HDR_SERVER, visible_appname_string);
     httpHeaderPutStr(hdr, HDR_MIME_VERSION, "1.0");
     httpHeaderPutTime(hdr, HDR_DATE, squid_curtime);
 
index deea028773164149b607b263f7755bbd36937e78..6b82af428891a803222492dfd42566d695a1e49b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.471 2005/04/25 15:46:35 serassio Exp $
+ * $Id: cache_cf.cc,v 1.472 2005/05/01 08:11:47 serassio Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -410,7 +410,13 @@ configDoConfigure(void)
         Config.onoff.announce = 0;
     }
 
+    if (Config.onoff.httpd_suppress_version_string)
+        visible_appname_string = (char *)appname_string;
+    else
+        visible_appname_string = (char *)full_appname_string;
+
 #if USE_DNSSERVERS
+
     if (Config.dnsChildren < 1)
         fatal("No dnsservers allocated");
 
@@ -434,7 +440,7 @@ configDoConfigure(void)
 
     snprintf(ThisCache, sizeof(ThisCache), "%s (%s)",
              uniqueHostname(),
-             full_appname_string);
+             visible_appname_string);
 
     /*
      * the extra space is for loop detection in client_side.c -- we search
@@ -442,7 +448,7 @@ configDoConfigure(void)
      */
     snprintf(ThisCache2, sizeof(ThisCache), " %s (%s)",
              uniqueHostname(),
-             full_appname_string);
+             visible_appname_string);
 
     if (!Config.udpMaxHitObjsz || Config.udpMaxHitObjsz > SQUID_UDP_SO_SNDBUF)
         Config.udpMaxHitObjsz = SQUID_UDP_SO_SNDBUF;
index b0c05461ddd682abfd558fc4cddeaa9f3caa0d28..f66e710322a39da319ccee95f9856600e7d59526 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.386 2005/04/24 14:00:45 serassio Exp $
+# $Id: cf.data.pre,v 1.387 2005/05/01 08:11:48 serassio Exp $
 #
 #
 # SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -2949,6 +2949,16 @@ DOC_START
 DOC_END
 
 
+NAME: httpd_suppress_version_string
+COMMENT: on|off
+TYPE: onoff
+DEFAULT: off
+LOC: Config.onoff.httpd_suppress_version_string
+DOC_START
+       Suppress Squid version string info in HTTP headers and HTML error pages.
+DOC_END
+
+
 NAME: visible_hostname
 TYPE: string
 LOC: Config.visibleHostname
index 93725a0da44b53d046f97fe7896a0f467d73688d..6a30bc23d93c701a698821fc5582b5b0981df1af 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.200 2005/04/23 13:20:30 serassio Exp $
+ * $Id: errorpage.cc,v 1.201 2005/05/01 08:11:48 serassio Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
@@ -739,7 +739,7 @@ errorConvert(char token, ErrorState * err)
         break;
 
     case 's':
-        p = full_appname_string;
+        p = visible_appname_string;
         break;
 
     case 'S':
index 3d4fd6ab126cc8b1ad69120f35e332a26557d87f..f16bb74c0d0155c9621a4686e63e79b7788f0b60 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.361 2005/03/05 14:51:52 serassio Exp $
+ * $Id: ftp.cc,v 1.362 2005/05/01 08:11:48 serassio Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -567,7 +567,7 @@ ftpListingFinish(FtpStateData * ftpState)
     storeAppendPrintf(e, "Generated %s by %s (%s)\n",
                       mkrfc1123(squid_curtime),
                       getMyHostname(),
-                      full_appname_string);
+                      visible_appname_string);
     storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
     storeBufferFlush(e);
 }
index 3c5bac7811b8da97f7b88d98724d4a59fc781f75..c0210c26b92412277e29b7cde9433e4352fe9c21 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: globals.h,v 1.131 2005/04/23 12:28:11 serassio Exp $
+ * $Id: globals.h,v 1.132 2005/05/01 08:11:48 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -56,6 +56,8 @@ extern const char *const localhost;   /* "127.0.0.1" */
 extern const char *const null_string;  /* "" */
 extern const char *const version_string;       /* VERSION */
 extern const char *const full_appname_string;  /* PACKAGE "/" VERSION */
+extern const char *const appname_string;       /* PACKAGE */
+extern char * visible_appname_string;
 extern const char *const w_space;      /* " \t\n\r" */
 extern const char *fdTypeStr[];
 extern const char *hier_strings[];
index 92208742d8af7cadd06c4828c201f930ee920065..57e95fca63a0d84318594caeb85bcfad9dc31008 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: gopher.cc,v 1.186 2005/01/28 09:23:41 serassio Exp $
+ * $Id: gopher.cc,v 1.187 2005/05/01 08:11:48 serassio Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -299,7 +299,7 @@ gopherHTMLFooter(StoreEntry * e)
     storeAppendPrintf(e, "Generated %s by %s (%s)\n",
                       mkrfc1123(squid_curtime),
                       getMyHostname(),
-                      full_appname_string);
+                      visible_appname_string);
     storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
 }
 
index 0508a4f1ba83c45f27b53b4c6032f99b48218c60..6fa91ef537479d73ac7fab2fa84f29e7e380849d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.517 2005/04/23 14:49:41 serassio Exp $
+ * $Id: structs.h,v 1.518 2005/05/01 08:11:48 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -382,6 +382,7 @@ struct _SquidConfig
     Log;
     char *adminEmail;
     char *effectiveUser;
+    char *visible_appname_string;
     char *effectiveGroup;
 
     struct
@@ -576,6 +577,7 @@ struct _SquidConfig
         int check_hostnames;
         int via;
         int emailErrData;
+        int httpd_suppress_version_string;
     }
 
     onoff;