disable generated by

From: Cláudio Borges <claudio@dont-contact.us>
Date: Thu, 31 May 2007 11:21:27 -0300

Hi personal, i made one patch that disable the line generated by in the
errors pages ftp e gopher. I am sending it in attach.

Thanks and sorry for my english.

--- src/cache_cf.c.orig 2007-02-26 19:45:24.000000000 -0300
+++ src/cache_cf.c 2007-05-27 18:12:08.000000000 -0300
@@ -407,6 +407,10 @@
         Config.Announce.period = 86400 * 365; /* one year */
         Config.onoff.announce = 0;
     }
+ if (Config.onoff.disable_generated_by_string)
+ generated_by_option = 1;
+ else
+ generated_by_option = 0;
     if (Config.onoff.httpd_suppress_version_string)
         visible_appname_string = (char *) appname_string;
     else
--- src/cf.data.pre.orig 2007-04-24 18:30:03.000000000 -0300
+++ src/cf.data.pre 2007-05-27 18:11:28.000000000 -0300
@@ -3339,6 +3339,16 @@
 DOC_END
 
 
+NAME: disable_generated_by_string
+COMMENT: on|off
+TYPE: onoff
+DEFAULT: off
+LOC: Config.onoff.disable_generated_by_string
+DOC_START
+ Disable the generated by string in ftp, gopher and error pages.
+DOC_END
+
+
 NAME: httpd_suppress_version_string
 COMMENT: on|off
 TYPE: onoff
--- src/errorpage.c.orig 2007-01-18 22:21:01.000000000 -0200
+++ src/errorpage.c 2007-05-27 18:10:04.000000000 -0300
@@ -147,9 +147,13 @@
 errorFindHardText(err_type type)
 {
     int i;
+ char *footer = "</BODY></HTML>\n";
     for (i = 0; i < error_hard_text_count; i++)
- if (error_hard_text[i].type == type)
+ if (error_hard_text[i].type == type) {
+ if (generated_by_option)
+ return footer;
             return error_hard_text[i].text;
+ }
     return NULL;
 }
 
--- src/ftp.c.orig 2007-03-26 20:41:43.000000000 -0300
+++ src/ftp.c 2007-05-27 18:09:01.000000000 -0300
@@ -362,8 +362,8 @@
     int i, j, k;
     const char *title = strBuf(ftpState->title_url);
     storeAppendPrintf(e, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
- storeAppendPrintf(e, "<!-- HTML listing generated by Squid %s -->\n",
- version_string);
+ if (!generated_by_option)
+ storeAppendPrintf(e, "<!-- HTML listing generated by Squid %s -->\n", version_string);
     storeAppendPrintf(e, "<!-- %s -->\n", mkrfc1123(squid_curtime));
     storeAppendPrintf(e, "<HTML><HEAD><TITLE>\n");
     {
@@ -431,13 +431,17 @@
         const char *path = ftpState->flags.dir_slash ? ftpState->filepath : ".";
         storeAppendPrintf(e, "<A HREF=\"%s/\">[As extended directory]</A>\n", rfc1738_escape_part(path));
     }
- storeAppendPrintf(e, "<HR noshade size=\"1px\">\n");
- storeAppendPrintf(e, "<ADDRESS>\n");
- storeAppendPrintf(e, "Generated %s by %s (%s)\n",
- mkrfc1123(squid_curtime),
- getMyHostname(),
- visible_appname_string);
- storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
+ if (generated_by_option) {
+ storeAppendPrintf(e, "</BODY></HTML>\n");
+ } else {
+ storeAppendPrintf(e, "<HR noshade size=\"1px\">\n");
+ storeAppendPrintf(e, "<ADDRESS>\n");
+ storeAppendPrintf(e, "Generated %s by %s (%s)\n",
+ mkrfc1123(squid_curtime),
+ getMyHostname(),
+ visible_appname_string);
+ storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
+ }
 }
 
 static const char *Month[] =
--- src/globals.h.orig 2007-01-18 22:19:26.000000000 -0200
+++ src/globals.h 2007-05-27 18:08:34.000000000 -0300
@@ -67,6 +67,7 @@
 extern const char *storeStatusStr[];
 extern const char *swapStatusStr[];
 extern fde *fd_table; /* NULL */
+extern int generated_by_option; /* 0 */
 extern int Biggest_FD; /* -1 */
 extern int Number_FD; /* 0 */
 extern int Opening_FD; /* 0 */
--- src/gopher.c.orig 2007-02-26 20:53:44.000000000 -0300
+++ src/gopher.c 2007-05-27 18:09:44.000000000 -0300
@@ -242,13 +242,17 @@
 static void
 gopherHTMLFooter(StoreEntry * e)
 {
- storeAppendPrintf(e, "<HR noshade size=\"1px\">\n");
- storeAppendPrintf(e, "<ADDRESS>\n");
- storeAppendPrintf(e, "Generated %s by %s (%s)\n",
- mkrfc1123(squid_curtime),
- getMyHostname(),
- visible_appname_string);
- storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
+ if (generated_by_option) {
+ storeAppendPrintf(e, "</BODY></HTML>\n");
+ } else {
+ storeAppendPrintf(e, "<HR noshade size=\"1px\">\n");
+ storeAppendPrintf(e, "<ADDRESS>\n");
+ storeAppendPrintf(e, "Generated %s by %s (%s)\n",
+ mkrfc1123(squid_curtime),
+ getMyHostname(),
+ visible_appname_string);
+ storeAppendPrintf(e, "</ADDRESS></BODY></HTML>\n");
+ }
 }
 
 static void
--- src/structs.h.orig 2007-04-26 20:11:51.000000000 -0300
+++ src/structs.h 2007-05-27 17:47:07.000000000 -0300
@@ -669,6 +669,7 @@
         int relaxed_header_parser;
         int accel_no_pmtu_disc;
         int global_internal_static;
+ int disable_generated_by_string;
         int httpd_suppress_version_string;
         int via;
         int check_hostnames;
Received on Thu May 31 2007 - 08:23:15 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Jun 01 2007 - 12:00:09 MDT