From: jongfoster Date: Sat, 26 May 2001 13:39:32 +0000 (+0000) Subject: Only crunches Content-Length header if applying RE filtering. X-Git-Tag: v_2_9_9~481 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=40186cfc06581b5e065af51ab06958d3a730bb82 Only crunches Content-Length header if applying RE filtering. Without this fix, Microsoft Windows Update wouldn't work. --- diff --git a/parsers.c b/parsers.c index 6d655b5d..ff58e7df 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.4 2001/05/22 18:46:04 oes Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.5 2001/05/26 00:28:36 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -41,6 +41,13 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.4 2001/05/22 18:46:04 oes Exp $"; * * Revisions : * $Log: parsers.c,v $ + * Revision 1.5 2001/05/26 00:28:36 jongfoster + * Automatic reloading of config file. + * Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32). + * Most of the global variables have been moved to a new + * struct configuration_spec, accessed through csp->config->globalname + * Most of the globals remaining are used by the Win32 GUI. + * * Revision 1.4 2001/05/22 18:46:04 oes * * - Enabled filtering banners by size rather than URL @@ -183,8 +190,10 @@ const struct parsers server_patterns[] = { { "connection:", 11, crumble }, #if defined(PCRS) || defined(KILLPOPUPS) { "Content-Type:", 13, content_type }, - { "Content-Length:", 15, crumble }, #endif /* defined(PCRS) || defined(KILLPOPUPS) */ +#ifdef PCRS + { "Content-Length:", 15, content_length }, +#endif /* def PCRS */ { NULL, 0, NULL } }; @@ -794,9 +803,39 @@ char *content_type(const struct parsers *v, char *s, struct client_state *csp) return(strdup(s)); } - #endif /* defined(PCRS) || defined(KILLPOPUPS) */ +#ifdef PCRS +/********************************************************************* + * + * Function : content_length + * + * Description : Crunch Content-Length header if & only if we are + * filtering this page through PCRS. + * + * Parameters : + * 1 : v = ignored + * 2 : s = header string we are "considering" + * 3 : csp = Current client state (buffers, headers, etc...) + * + * Returns : A duplicate string pointer to this header (ie. pass thru) + * + *********************************************************************/ +char *content_length(const struct parsers *v, char *s, struct client_state *csp) +{ + if ((csp->permissions & PERMIT_RE_FILTER) != 0) + { + log_error(LOG_LEVEL_HEADER, "crunch!"); + return(NULL); + } + else + { + return(strdup(s)); + } +} + +#endif /* def PCRS */ + /********************************************************************* * @@ -1235,9 +1274,9 @@ void client_x_forwarded_adder(struct client_state *csp) { char *p = NULL; - if (csp->config->add_forwarded == 0) - { - return; + if (csp->config->add_forwarded == 0) + { + return; } if (csp->x_forwarded) diff --git a/parsers.h b/parsers.h index ad3521b9..b03a0cd8 100644 --- a/parsers.h +++ b/parsers.h @@ -1,6 +1,6 @@ #ifndef _PARSERS_H #define _PARSERS_H -#define PARSERS_H_VERSION "$Id: parsers.h,v 1.1.1.1 2001/05/15 13:59:01 oes Exp $" +#define PARSERS_H_VERSION "$Id: parsers.h,v 1.2 2001/05/20 01:21:20 jongfoster Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.h,v $ @@ -43,6 +43,19 @@ * * Revisions : * $Log: parsers.h,v $ + * Revision 1.2 2001/05/20 01:21:20 jongfoster + * Version 2.9.4 checkin. + * - Merged popupfile and cookiefile, and added control over PCRS + * filtering, in new "permissionsfile". + * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration + * file error you now get a message box (in the Win32 GUI) rather + * than the program exiting with no explanation. + * - Made killpopup use the PCRS MIME-type checking and HTTP-header + * skipping. + * - Removed tabs from "config" + * - Moved duplicated url parsing code in "loaders.c" to a new funcition. + * - Bumped up version number. + * * Revision 1.1.1.1 2001/05/15 13:59:01 oes * Initial import of version 2.9.3 source tree * @@ -91,6 +104,10 @@ extern char *server_set_cookie(const struct parsers *v, char *s, struct client_s extern char *content_type(const struct parsers *v, char *s, struct client_state *csp); #endif /* defined(PCRS) || defined(KILLPOPUPS) */ +#ifdef PCRS +extern char *content_length(const struct parsers *v, char *s, struct client_state *csp); +#endif /* def PCRS */ + #ifdef FORCE_LOAD char *client_host(const struct parsers *v, char *s, struct client_state *csp); int strclean(const char *string, const char *substring);