From: wessels <> Date: Fri, 21 Feb 1997 05:22:54 +0000 (+0000) Subject: make http-anonymizing always compiled in, settable in config file X-Git-Tag: SQUID_3_0_PRE1~5093 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa562c673b33bbbe1b5ef1203bfab9d6f7baa7fa;p=thirdparty%2Fsquid.git make http-anonymizing always compiled in, settable in config file --- diff --git a/src/Makefile.in b/src/Makefile.in index 1c157f7d6d..3a86287fe2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -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 \ diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 868521677e..e8a4be1541 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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); diff --git a/src/http.cc b/src/http.cc index ec12027be0..2ae35c589f 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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); diff --git a/src/squid.h b/src/squid.h index 513cd3b900..a4c16fa953 100644 --- a/src/squid.h +++ b/src/squid.h @@ -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;