1 #ifndef FILTERS_H_INCLUDED
2 #define FILTERS_H_INCLUDED
3 #define FILTERS_H_VERSION "$Id: filters.h,v 1.16 2002/01/17 21:01:02 jongfoster Exp $"
4 /*********************************************************************
6 * File : $Source: /cvsroot/ijbswa/current/filters.h,v $
8 * Purpose : Declares functions to parse/crunch headers and pages.
9 * Functions declared include:
10 * `acl_addr', `add_stats', `block_acl', `block_imageurl',
11 * `block_url', `url_actions', `filter_popups', `forward_url'
12 * `ij_untrusted_url', `intercept_url', `re_process_buffer',
13 * `show_proxy_args', and `trust_url'
15 * Copyright : Written by and Copyright (C) 2001 the SourceForge
16 * Privoxy team. http://ijbswa.sourceforge.net
18 * Based on the Internet Junkbuster originally written
19 * by and Copyright (C) 1997 Anonymous Coders and
20 * Junkbusters Corporation. http://www.junkbusters.com
22 * This program is free software; you can redistribute it
23 * and/or modify it under the terms of the GNU General
24 * Public License as published by the Free Software
25 * Foundation; either version 2 of the License, or (at
26 * your option) any later version.
28 * This program is distributed in the hope that it will
29 * be useful, but WITHOUT ANY WARRANTY; without even the
30 * implied warranty of MERCHANTABILITY or FITNESS FOR A
31 * PARTICULAR PURPOSE. See the GNU General Public
32 * License for more details.
34 * The GNU General Public License should be included with
35 * this file. If not, you can view it at
36 * http://www.gnu.org/copyleft/gpl.html
37 * or write to the Free Software Foundation, Inc., 59
38 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
42 * Revision 1.16 2002/01/17 21:01:02 jongfoster
43 * Moving all our URL and URL pattern parsing code to urlmatch.c.
45 * Revision 1.15 2001/10/10 16:44:16 oes
46 * Added match_portlist function
48 * Revision 1.14 2001/10/07 15:41:40 oes
49 * Added prototype for remove_chunked_transfer_coding
51 * Revision 1.13 2001/07/30 22:08:36 jongfoster
52 * Tidying up #defines:
53 * - All feature #defines are now of the form FEATURE_xxx
54 * - Permanently turned off WIN_GUI_EDIT
55 * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
57 * Revision 1.12 2001/07/29 19:01:11 jongfoster
58 * Changed _FILENAME_H to FILENAME_H_INCLUDED.
59 * Added forward declarations for needed structures.
61 * Revision 1.11 2001/07/13 14:00:18 oes
62 * - Introduced gif_deanimate_response
63 * - Renamed re_process_buffer to pcrs_filter_response
64 * - Removed all #ifdef PCRS
66 * Revision 1.10 2001/06/29 13:29:01 oes
67 * Cleaned up and updated to reflect the changesin
70 * Revision 1.9 2001/06/07 23:10:53 jongfoster
71 * Replacing struct gateway with struct forward_spec
73 * Revision 1.8 2001/06/03 19:12:00 oes
74 * extracted-CGI relevant stuff
76 * Revision 1.7 2001/05/31 21:21:30 jongfoster
77 * Permissionsfile / actions file changes:
78 * - Changed "permission" to "action" throughout
79 * - changes to file format to allow string parameters
80 * - Moved helper functions to actions.c
82 * Revision 1.6 2001/05/29 09:50:24 jongfoster
83 * Unified blocklist/imagelist/permissionslist.
84 * File format is still under discussion, but the internal changes
87 * Also modified interceptor behaviour:
88 * - We now intercept all URLs beginning with one of the following
89 * prefixes (and *only* these prefixes):
91 * * http://ijbswa.sf.net/config/
92 * * http://ijbswa.sourceforge.net/config/
93 * - New interceptors "home page" - go to http://i.j.b/ to see it.
94 * - Internal changes so that intercepted and fast redirect pages
95 * are not replaced with an image.
96 * - Interceptors now have the option to send a binary page direct
97 * to the client. (i.e. ijb-send-banner uses this)
98 * - Implemented show-url-info interceptor. (Which is why I needed
99 * the above interceptors changes - a typical URL is
100 * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
101 * The previous mechanism would not have intercepted that, and
102 * if it had been intercepted then it then it would have replaced
105 * Revision 1.5 2001/05/27 22:17:04 oes
107 * - re_process_buffer no longer writes the modified buffer
108 * to the client, which was very ugly. It now returns the
109 * buffer, which it is then written by chat.
111 * - content_length now adjusts the Content-Length: header
112 * for modified documents rather than crunch()ing it.
113 * (Length info in csp->content_length, which is 0 for
114 * unmodified documents)
116 * - For this to work, sed() is called twice when filtering.
118 * Revision 1.4 2001/05/26 15:26:15 jongfoster
119 * ACL feature now provides more security by immediately dropping
120 * connections from untrusted hosts.
122 * Revision 1.3 2001/05/22 18:46:04 oes
124 * - Enabled filtering banners by size rather than URL
125 * by adding patterns that replace all standard banner
126 * sizes with the "Junkbuster" gif to the re_filterfile
128 * - Enabled filtering WebBugs by providing a pattern
129 * which kills all 1x1 images
131 * - Added support for PCRE_UNGREEDY behaviour to pcrs,
132 * which is selected by the (nonstandard and therefore
133 * capital) letter 'U' in the option string.
134 * It causes the quantifiers to be ungreedy by default.
135 * Appending a ? turns back to greedy (!).
137 * - Added a new interceptor ijb-send-banner, which
138 * sends back the "Junkbuster" gif. Without imagelist or
139 * MSIE detection support, or if tinygif = 1, or the
140 * URL isn't recognized as an imageurl, a lame HTML
141 * explanation is sent instead.
143 * - Added new feature, which permits blocking remote
144 * script redirects and firing back a local redirect
146 * The feature is conditionally compiled, i.e. it
147 * can be disabled with --disable-fast-redirects,
148 * plus it must be activated by a "fast-redirects"
149 * line in the config file, has its own log level
150 * and of course wants to be displayed by show-proxy-args
151 * Note: Boy, all the #ifdefs in 1001 locations and
152 * all the fumbling with configure.in and acconfig.h
153 * were *way* more work than the feature itself :-(
155 * - Because a generic redirect template was needed for
156 * this, tinygif = 3 now uses the same.
158 * - Moved GIFs, and other static HTTP response templates
163 * - Removed some >400 CRs again (Jon, you really worked
166 * Revision 1.2 2001/05/20 01:21:20 jongfoster
167 * Version 2.9.4 checkin.
168 * - Merged popupfile and cookiefile, and added control over PCRS
169 * filtering, in new "permissionsfile".
170 * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
171 * file error you now get a message box (in the Win32 GUI) rather
172 * than the program exiting with no explanation.
173 * - Made killpopup use the PCRS MIME-type checking and HTTP-header
175 * - Removed tabs from "config"
176 * - Moved duplicated url parsing code in "loaders.c" to a new funcition.
177 * - Bumped up version number.
179 * Revision 1.1.1.1 2001/05/15 13:58:52 oes
180 * Initial import of version 2.9.3 source tree
183 *********************************************************************/
193 struct access_control_addr;
196 struct http_response;
197 struct current_action_spec;
206 extern int block_acl(struct access_control_addr *dst, struct client_state *csp);
207 extern int acl_addr(char *aspec, struct access_control_addr *aca);
208 #endif /* def FEATURE_ACL */
209 extern int match_portlist(const char *portlist, int port);
214 extern struct http_response *block_url(struct client_state *csp);
215 extern struct http_response *redirect_url(struct client_state *csp);
216 #ifdef FEATURE_COOKIE_JAR
217 extern struct http_response *trust_url(struct client_state *csp);
218 #endif /* def FEATURE_COOKIE_JAR */
223 #ifdef FEATURE_COOKIE_JAR
224 extern int is_untrusted_url(struct client_state *csp);
225 #endif /* def FEATURE_COOKIE_JAR */
226 #ifdef FEATURE_IMAGE_BLOCKING
227 extern int is_imageurl(struct client_state *csp);
228 #endif /* def FEATURE_IMAGE_BLOCKING */
231 * Determining applicable actions
233 extern void url_actions(struct http_request *http,
234 struct client_state *csp);
235 extern void apply_url_actions(struct current_action_spec *action,
236 struct http_request *http,
237 struct url_actions *b);
239 * Determining parent proxies
241 extern const struct forward_spec *forward_url(struct http_request *http, struct client_state *csp);
244 * Content modification
246 extern char *pcrs_filter_response(struct client_state *csp);
247 extern char *gif_deanimate_response(struct client_state *csp);
248 extern int remove_chunked_transfer_coding(char *buffer, const size_t size);
251 * Revision control strings from this header and associated .c file
253 extern const char filters_rcs[];
254 extern const char filters_h_rcs[];
260 #endif /* ndef FILTERS_H_INCLUDED */