From: Fabian Keil Date: Fri, 19 Oct 2007 16:53:28 +0000 (+0000) Subject: Add helper function to check if any content filters are enabled. X-Git-Tag: v_3_0_7~123 X-Git-Url: http://www.privoxy.org/gitweb/appendix.html?a=commitdiff_plain;h=0378c261d3ae25e1b5cdb962dbc7a9ab54331ec9;p=privoxy.git Add helper function to check if any content filters are enabled. --- diff --git a/filters.c b/filters.c index a8642389..6138758f 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.94 2007/09/29 13:20:20 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.95 2007/10/17 19:31:20 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -40,6 +40,10 @@ const char filters_rcs[] = "$Id: filters.c,v 1.94 2007/09/29 13:20:20 fabiankeil * * Revisions : * $Log: filters.c,v $ + * Revision 1.95 2007/10/17 19:31:20 fabiankeil + * Omitting the zero chunk that ends the chunk transfer encoding seems + * to be the new black. Log the problem and continue filtering anyway. + * * Revision 1.94 2007/09/29 13:20:20 fabiankeil * Remove two redundant and one useless log messages. * @@ -2646,6 +2650,26 @@ struct http_response *direct_response(struct client_state *csp) } +/********************************************************************* + * + * Function : content_filters_enabled + * + * Description : Checks whether there are any content filters + * enabled for the current request. + * + * Parameters : + * 1 : csp = Current client state (buffers, headers, etc...) + * + * Returns : TRUE for yes, FALSE otherwise + * + *********************************************************************/ +inline int content_filters_enabled(const struct client_state *csp) +{ + return (((csp->rlist != NULL) && + (!list_is_empty(csp->action->multi[ACTION_MULTI_FILTER]))) || + (csp->action->flags & (ACTION_DEANIMATE|ACTION_JPEG_INSPECT|ACTION_NO_POPUPS))); +} + /* Local Variables: tab-width: 3 diff --git a/filters.h b/filters.h index 12bfdd74..f768047f 100644 --- a/filters.h +++ b/filters.h @@ -1,6 +1,6 @@ #ifndef FILTERS_H_INCLUDED #define FILTERS_H_INCLUDED -#define FILTERS_H_VERSION "$Id: filters.h,v 1.29 2007/09/28 16:38:55 fabiankeil Exp $" +#define FILTERS_H_VERSION "$Id: filters.h,v 1.30 2007/09/29 10:21:16 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.h,v $ @@ -39,6 +39,11 @@ * * Revisions : * $Log: filters.h,v $ + * Revision 1.30 2007/09/29 10:21:16 fabiankeil + * - Move get_filter_function() from jcc.c to filters.c + * so the filter functions can be static. + * - Don't bother filtering body-less responses. + * * Revision 1.29 2007/09/28 16:38:55 fabiankeil * - Execute content filters through execute_content_filter(). * - Add prepare_for_filtering() so filter functions don't have to @@ -317,6 +322,7 @@ extern char *get_last_url(char *subject, const char *redirect_mode); extern pcrs_job *compile_dynamic_pcrs_job_list(const struct client_state *csp, const struct re_filterfile_spec *b); +extern inline int content_filters_enabled(const struct client_state *csp); /* * Handling Max-Forwards: