-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.48 2007/02/13 14:35:25 fabiankeil Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.49 2007/03/20 15:16:34 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
*
* Revisions :
* $Log: cgiedit.c,v $
+ * Revision 1.49 2007/03/20 15:16:34 fabiankeil
+ * Use dedicated header filter actions instead of abusing "filter".
+ * Replace "filter-client-headers" and "filter-client-headers"
+ * with "server-header-filter" and "client-header-filter".
+ *
* Revision 1.48 2007/02/13 14:35:25 fabiankeil
* Replace hash escaping code to prevent
* crashes, memory and file corruption.
{
/*
* List available filters and their settings.
- *
- * XXX: Different types of filters should use different
- * @substitution strings@. They are currently listed
- * in the order they appear in the filter files and
- * are all inserted as @filter-params@ which can lead
- * to an "interesting" mix.
*/
- char * result;
+ char *content_filter_params;
+ char *server_header_filter_params;
+ char *client_header_filter_params;
+ char *filter_template;
int filter_identifier = 0;
- char * filter_template;
err = template_load(csp, &filter_template, "edit-actions-for-url-filter", 0);
if (err)
err = template_fill(&filter_template, exports);
- result = strdup("");
+ content_filter_params = strdup("");
+ server_header_filter_params = strdup("");
+ client_header_filter_params = strdup("");
for (i = 0; i < MAX_AF_FILES; i++)
{
for (;(!err) && (filter_group != NULL); filter_group = filter_group->next)
{
char current_mode = 'x';
- struct list_entry *filter_name;
- char * this_line;
- struct map *line_exports;
char number[20];
int multi_action_index = 0;
+ struct list_entry *filter_name;
+ struct map *line_exports;
+ char *this_line;
char *filter_type;
char *abbr_filter_type;
+ char *anchor;
+ char **current_params;
switch (filter_group->type)
{
filter_type = "filter";
abbr_filter_type = "F";
multi_action_index = ACTION_MULTI_FILTER;
+ anchor = "FILTER";
+ current_params = &content_filter_params;
break;
case FT_SERVER_HEADER_FILTER:
filter_type = "server-header-filter";
abbr_filter_type = "S";
multi_action_index = ACTION_MULTI_SERVER_HEADER_FILTER;
+ current_params = &server_header_filter_params;
+ anchor = "SERVER-HEADER-FILTER"; /* XXX: no documentation available yet */
break;
case FT_CLIENT_HEADER_FILTER:
filter_type = "client-header-filter";
abbr_filter_type = "C";
multi_action_index = ACTION_MULTI_CLIENT_HEADER_FILTER;
+ current_params = &client_header_filter_params;
+ anchor = "CLIENT-HEADER-FILTER"; /* XXX: no documentation available yet */
break;
default:
log_error(LOG_LEVEL_FATAL,
if (line_exports == NULL)
{
err = JB_ERR_MEMORY;
- freez(result);
+ freez(*current_params); /* XXX: really necessary? */
}
else
{
if (!err) err = map_radio(line_exports, "this-filter", "ynx", current_mode);
if (!err) err = map(line_exports, "filter-type", 1, filter_type, 1);
if (!err) err = map(line_exports, "abbr-filter-type", 1, abbr_filter_type, 1);
+ if (!err) err = map(line_exports, "anchor", 1, anchor, 1);
this_line = NULL;
if (!err)
if (this_line == NULL) err = JB_ERR_MEMORY;
}
if (!err) err = template_fill(&this_line, line_exports);
- string_join(&result, this_line);
+ string_join(current_params, this_line);
free_map(line_exports);
}
}
freez(filter_template);
- if (!err)
- {
- err = map(exports, "filter-params", 1, result, 0);
- }
- else
+ if (!err) err = map(exports, "content-filter-params", 1, content_filter_params, 0);
+ if (!err) err = map(exports, "server-header-filter-params", 1, server_header_filter_params, 0);
+ if (!err) err = map(exports, "client-header-filter-params", 1, client_header_filter_params, 0);
+ if (err)
{
- freez(result);
+ freez(content_filter_params);
+ freez(server_header_filter_params);
+ freez(client_header_filter_params);
}
}
# particular section in an actions file.
#
#
-# Copyright : Written by and Copyright (C) 2001 the SourceForge
+# Copyright : Written by and Copyright (C) 2001-2007 the SourceForge
# Privoxy team. http://www.privoxy.org/
#
# Original Author: Copyright (C) 2001 Jonathan Foster
#
# Revisions :
# $Log: edit-actions-for-url,v $
+# Revision 1.42 2007/03/20 15:40:00 fabiankeil
+# Adjust to new world order with dedicated header-filter actions.
+#
# Revision 1.41 2007/01/23 16:03:16 fabiankeil
# - Add favicon links.
# - Remove useless W3C validator links.
<td class="action"><a href="@user-manual@@actions-help-prefix@BLOCK">block</a></td>
<td>Block the request</td>
</tr>
+
+@client-header-filter-params@
+
<tr class="bg1" align="left" valign="top">
<td class="en1" align="center" valign="middle"><input type="radio"
name="content_type_overwrite" value="Y" @content-type-overwrite-y@
all filters applied by previous rules, and/or you can enable or
disable the filters individually below.</td>
</tr>
-@filter-params@
+
+@content-filter-params@
+
<!-- @if-multiple-forms-start -->
</table>
<p>
it on if it was off, is not yet supported using this web-based
editor.</td>
</tr>
+
+@server-header-filter-params@
+
<tr class="bg1" align="left" valign="top">
<td class="en1" align="center" valign="middle"><input type="radio"
name="session_cookies_only" value="Y" @session-cookies-only-y@