]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
make http-anonymizing always compiled in, settable in config file
authorwessels <>
Fri, 21 Feb 1997 05:22:54 +0000 (05:22 +0000)
committerwessels <>
Fri, 21 Feb 1997 05:22:54 +0000 (05:22 +0000)
src/Makefile.in
src/cache_cf.cc
src/http.cc
src/squid.h

index 1c157f7d6d57e58dd094382a4a7dcad0e22308b3..3a86287fe273383eb49a6d622415a0d6af281ab0 100644 (file)
@@ -1,7 +1,7 @@
 #
 #  Makefile for the Squid Object Cache server
 #
-#  $Id: Makefile.in,v 1.63 1997/02/20 21:09:04 wessels Exp $
+#  $Id: Makefile.in,v 1.64 1997/02/20 22:22:54 wessels Exp $
 #
 #  Uncomment and customize the following to suit your needs:
 #
@@ -13,7 +13,6 @@ DELAY_HACK      = # -DDELAY_HACK=1
 USERAGENT_OPT  = # -DUSE_USERAGENT_LOG=1
 KILL_PARENT_OPT        = # -DKILL_PARENT_OPT
 USE_POLL_OPT    = # -DUSE_POLL
-ANON_OPT        = # -DUSE_ANONYMIZER
 #
 # do NOT define both USE_SPLAY_TREE and USE_BIN_TREE, only 1 at a time!
 #
@@ -21,7 +20,7 @@ USE_SPLAY_TREE  = # -DUSE_SPLAY_TREE
 USE_BIN_TREE    = # -DUSE_BIN_TREE
 DEFINES         = $(HOST_OPT) $(AUTH_OPT) $(LOG_HDRS_OPT) \
                   $(ICMP_OPT) $(DELAY_HACK) $(USERAGENT_OPT) \
-                  $(KILL_PARENT_OPT) $(USE_POLL_OPT) $(ANON_OPT) \
+                  $(KILL_PARENT_OPT) $(USE_POLL_OPT) \
                   $(USE_SPLAY_TREE) $(USE_BIN_TREE)
 
 prefix         = @prefix@
@@ -92,6 +91,7 @@ OBJS          = \
                gopher.o \
                hash.o \
                http.o \
+               http-anon.o \
                icmp.o \
                icp.o \
                ident.o \
index 868521677ebe77137e9aa4a2eefc46a3d4ec5123..e8a4be15417ba59be139cd03cbe6c813ffd30683 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.172 1997/02/19 17:05:21 wessels Exp $
+ * $Id: cache_cf.cc,v 1.173 1997/02/20 22:22:55 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -258,6 +258,7 @@ static void ip_acl_destroy _PARAMS((ip_acl **));
 static void parseCachemgrPasswd _PARAMS((void));
 static void parsePathname _PARAMS((char **));
 static void parseProxyLine _PARAMS((peer **));
+static void parseHttpAnonymizer _PARAMS((int *));
 
 static void
 self_destruct(void)
@@ -1025,6 +1026,21 @@ parseCachemgrPasswd(void)
     wordlistDestroy(&actions);
 }
 
+static void
+parseHttpAnonymizer(int *iptr)
+{
+    char *token;
+    token = strtok(NULL, w_space);
+    if (token == NULL)
+        self_destruct();
+    if (!strcasecmp(token, "off"))
+       *iptr = ANONYMIZER_NONE;
+    else if (!strcasecmp(token, "paranoid"))
+       *iptr = ANONYMIZER_PARANOID;
+    else
+       *iptr = ANONYMIZER_STANDARD;
+}
+
 int
 parseConfigFile(const char *file_name)
 {
@@ -1347,6 +1363,8 @@ parseConfigFile(const char *file_name)
            parseOnOff(&opt_forwarded_for);
        else if (!strcmp(token, "log_icp_queries"))
            parseOnOff(&Config.Options.log_udp);
+       else if (!strcmp(token, "http_anonymizer"))
+           parseHttpAnonymizer(&Config.Options.anonymizer);
 
        else if (!strcmp(token, "minimum_direct_hops"))
            parseIntegerValue(&Config.minDirectHops);
index ec12027be0fe40ffc81cd5cc6c8b4842988a3cb7..2ae35c589faef29abb2e070e9c482108ba6f9967 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: http.cc,v 1.147 1997/01/31 23:44:10 wessels Exp $
+ * $Id: http.cc,v 1.148 1997/02/20 22:23:02 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -682,27 +682,19 @@ httpSendComplete(int fd, char *buf, int size, int errflag, void *data)
     }
 }
 
-#ifdef USE_ANONYMIZER
-#include "http-anon.c"
-#endif
-
 static void
 httpAppendRequestHeader(char *hdr, const char *line, size_t * sz, size_t max)
 {
     size_t n = *sz + strlen(line) + 2;
     if (n >= max)
        return;
-#ifdef USE_ANONYMIZER
-#ifdef USE_PARANOID_ANONYMIZER
-    if (httpAnonSearchHeaderField(http_anon_allowed_header, line) == NULL) {
-#else
-    if (httpAnonSearchHeaderField(http_anon_denied_header, line) == NULL) {
-#endif
-       debug(11, 5, "httpAppendRequestHeader: removed for anonymity: <%s>\n",
-           line);
-       return;
+    if (Config.Options.anonymizer == ANONYMIZER_PARANOID) {
+        if (!httpAnonAllowed(line))
+           return;
+    } else if (Config.Options.anonymizer == ANONYMIZER_STANDARD) {
+        if (httpAnonDenied(line))
+           return;
     }
-#endif
     /* allowed header, explicitly known to be not dangerous */
     debug(11, 5, "httpAppendRequestHeader: %s\n", line);
     strcpy(hdr + (*sz), line);
index 513cd3b9000f65eae58b67fd8a9aa129044a006d..a4c16fa95303541a77088c9d2aa46f2e9aba47e5 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: squid.h,v 1.93 1997/01/31 22:30:36 wessels Exp $
+ * $Id: squid.h,v 1.94 1997/02/20 22:23:08 wessels Exp $
  *
  * AUTHOR: Duane Wessels
  *
@@ -354,6 +354,8 @@ extern int passStart _PARAMS((int fd,
        int *size_ptr));
 extern void identStart _PARAMS((int, icpStateData *,
        void       (*callback) _PARAMS((void *))));
+extern int httpAnonAllowed _PARAMS((const char *line));
+extern int httpAnonDenied _PARAMS((const char *line));
 
 extern const char *const dash_str;
 extern const char *const null_string;