-const char filters_rcs[] = "$Id: filters.c,v 1.127 2010/04/03 13:22:56 fabiankeil Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.128 2010/04/03 13:23:28 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.c,v $
* `execute_single_pcrs_command', `rewrite_url',
* `get_last_url'
*
- * Copyright : Written by and Copyright (C) 2001, 2004-2009 the
+ * Copyright : Written by and Copyright (C) 2001-2010 the
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
*********************************************************************/
static char *pcrs_filter_response(struct client_state *csp)
{
- int hits=0;
+ int hits = 0;
+ int i;
size_t size, prev_size;
char *old = NULL;
struct re_filterfile_spec *b;
struct list_entry *filtername;
- int i, found_filters = 0;
-
/*
* Sanity first
*/
return(NULL);
}
- /*
- * Need to check the set of re_filterfiles...
- */
- for (i = 0; i < MAX_AF_FILES; i++)
- {
- fl = csp->rlist[i];
- if (NULL != fl)
- {
- if (NULL != fl->f)
- {
- found_filters = 1;
- break;
- }
- }
- }
-
- if (0 == found_filters)
+ if (filters_available(csp) == FALSE)
{
log_error(LOG_LEVEL_ERROR, "Inconsistent configuration: "
"content filtering enabled, but no content filters available.");
!list_is_empty(action->multi[ACTION_MULTI_FILTER]));
}
+
+/*********************************************************************
+ *
+ * Function : filters_available
+ *
+ * Description : Checks whether there are any filters available.
+ *
+ * Parameters :
+ * 1 : csp = Current client state (buffers, headers, etc...)
+ *
+ * Returns : TRUE for yes, FALSE otherwise.
+ *
+ *********************************************************************/
+int filters_available(const struct client_state *csp)
+{
+ int i;
+ for (i = 0; i < MAX_AF_FILES; i++)
+ {
+ const struct file_list *fl = csp->rlist[i];
+ if ((NULL != fl) && (NULL != fl->f))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
/*
Local Variables:
tab-width: 3
#ifndef FILTERS_H_INCLUDED
#define FILTERS_H_INCLUDED
-#define FILTERS_H_VERSION "$Id: filters.h,v 1.36 2008/05/21 15:35:08 fabiankeil Exp $"
+#define FILTERS_H_VERSION "$Id: filters.h,v 1.37 2009/05/16 13:27:20 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.h,v $
* `ij_untrusted_url', `intercept_url', `re_process_buffer',
* `show_proxy_args', and `trust_url'
*
- * Copyright : Written by and Copyright (C) 2001, 2004 the SourceForge
+ * Copyright : Written by and Copyright (C) 2001-2010 the
* Privoxy team. http://www.privoxy.org/
*
* Based on the Internet Junkbuster originally written
extern pcrs_job *compile_dynamic_pcrs_job_list(const struct client_state *csp, const struct re_filterfile_spec *b);
extern int content_filters_enabled(const struct current_action_spec *action);
+extern int filters_available(const struct client_state *csp);
/*
* Handling Max-Forwards:
-const char parsers_rcs[] = "$Id: parsers.c,v 1.209 2009/09/06 14:11:06 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.210 2009/12/25 11:39:26 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
struct re_filterfile_spec *b;
struct list_entry *tag_name;
- int found_filters = 0;
const size_t header_length = strlen(header);
if (csp->flags & CSP_FLAG_CLIENT_HEADER_PARSING_DONE)
multi_action_index = ACTION_MULTI_CLIENT_HEADER_TAGGER;
}
- /* Check if there are any filters */
- for (i = 0; i < MAX_AF_FILES; i++)
- {
- fl = csp->rlist[i];
- if (NULL != fl)
- {
- if (NULL != fl->f)
- {
- found_filters = 1;
- break;
- }
- }
- }
-
- if (0 == found_filters)
+ if (filters_available(csp) == FALSE)
{
log_error(LOG_LEVEL_ERROR, "Inconsistent configuration: "
"tagging enabled, but no taggers available.");
struct re_filterfile_spec *b;
struct list_entry *filtername;
- int i, found_filters = 0;
+ int i;
int wanted_filter_type;
int multi_action_index;
multi_action_index = ACTION_MULTI_CLIENT_HEADER_FILTER;
}
- /*
- * Need to check the set of re_filterfiles...
- */
- for (i = 0; i < MAX_AF_FILES; i++)
- {
- fl = csp->rlist[i];
- if (NULL != fl)
- {
- if (NULL != fl->f)
- {
- found_filters = 1;
- break;
- }
- }
- }
-
- if (0 == found_filters)
+ if (filters_available(csp) == FALSE)
{
log_error(LOG_LEVEL_ERROR, "Inconsistent configuration: "
"header filtering enabled, but no matching filters available.");