* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: acconfig.h,v $
- * Revision 1.35 2008/04/06 15:18:33 fabiankeil
- * Oh well, rename the --enable-pcre-host-patterns option to
- * --enable-extended-host-patterns as it's not really PCRE syntax.
- *
- * Revision 1.34 2008/04/06 14:54:26 fabiankeil
- * Use PCRE syntax in host patterns when configured
- * with --enable-pcre-host-patterns.
- *
- * Revision 1.33 2006/12/17 19:15:26 fabiankeil
- * Added ./configure switch for FEATURE_GRACEFUL_TERMINATION.
- *
- * Revision 1.32 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.27.2.4 2003/12/17 16:34:40 oes
- * Cosmetics
- *
- * Revision 1.27.2.3 2003/03/27 16:03:19 oes
- * Another shot at Bug #707467
- *
- * Revision 1.27.2.2 2003/03/21 14:39:12 oes
- * Presumably fixed Bug #707467 by defining unix ifdef __unix__
- *
- * Revision 1.27.2.1 2002/08/10 11:22:31 oes
- * - Add two AC_DEFINEs that indicate if the pcre*.h headers
- * are located in a pcre/ subdir to the include path.
- *
- * Revision 1.27 2002/04/25 19:13:57 morcego
- * Removed RPM release number declaration on configure.in
- * Changed makefile to use given value for RPM_PACKAGEV when on uploading
- * targets (will produce an error, explaining who to do it, if no value
- * if provided).
- *
- * Revision 1.26 2002/04/11 11:00:21 oes
- * Applied Moritz' fix for socklen_t on Solaris
- *
- * Revision 1.25 2002/04/06 20:38:01 jongfoster
- * Renaming VC++ versions of config.h
- *
- * Revision 1.24 2002/04/04 00:36:36 gliptak
- * always use pcre for matching
- *
- * Revision 1.23 2002/04/03 22:28:03 gliptak
- * Removed references to gnu_regex
- *
- * Revision 1.22 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.21 2002/03/24 14:31:08 swa
- * remove more crappy files. set RPM
- * release version correctly.
- *
- * Revision 1.20 2002/03/24 13:46:44 swa
- * name change related issue.
- *
- * Revision 1.19 2002/03/24 13:25:42 swa
- * name change related issues
- *
- * Revision 1.18 2002/03/08 16:40:28 oes
- * Added FEATURE_NO_GIFS
- *
- * Revision 1.17 2002/03/04 17:52:44 oes
- * Deleted PID_FILE_PATH
- *
- * Revision 1.16 2002/01/10 12:36:18 oes
- * Moved HAVE_*_R to acconfig.h, where they belong.
- *
- * Revision 1.15 2001/12/30 14:07:31 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.14 2001/10/23 21:24:09 jongfoster
- * Support for FEATURE_CGI_EDIT_ACTIONS
- *
- * Revision 1.13 2001/10/07 15:30:41 oes
- * Removed FEATURE_DENY_GZIP
- *
- * Revision 1.12 2001/09/13 19:56:37 jongfoster
- * Reverting to revision 1.10 - previous checking was majorly broken.
- *
- * Revision 1.10 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.9 2001/07/29 19:08:52 jongfoster
- * Changing _CONFIG_H to CONFIG_H_INCLUDED.
- * Also added protection against using a MinGW32 or CygWin version of
- * config.h from within MS Visual C++
- *
- * Revision 1.8 2001/07/29 17:09:17 jongfoster
- * Major changes to build system in order to fix these bugs:
- * - pthreads under Linux was broken - changed -lpthread to -pthread
- * - Compiling in MinGW32 mode under CygWin now correctly detects
- * which shared libraries are available
- * - Solaris support (?) (Not tested under Solaris yet)
- *
- * Revision 1.7 2001/07/25 22:53:59 jongfoster
- * Will #error if pthreads is enabled under BeOs
- *
- * Revision 1.6 2001/07/15 17:54:29 jongfoster
- * Renaming #define STATIC to STATIC_PCRE
- * Adding new #define FEATURE_PTHREAD that will be used to enable
- * POSIX threads support.
- *
- * Revision 1.5 2001/07/13 13:48:37 oes
- * - (Fix:) Copied CODE_STATUS #define from config.h.in
- * - split REGEX #define into REGEX_GNU and REGEX_PCRE
- * and removed PCRE.
- * (REGEX = REGEX_GNU || REGEX_PCRE per project.h)
- * - Moved STATIC (for pcre) here from Makefile.in
- * - Introduced STATIC_PCRS #define to allow for dynaimc linking with
- * libpcrs
- * - Removed PCRS #define, since pcrs is now needed for CGI anyway
- *
- * Revision 1.4 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.3 2001/05/26 01:26:34 jongfoster
- * New #define, WIN_GUI_EDIT, enables the (embryonic) Win32 GUI editor.
- * This #define cannot be set from ./configure - there's no point, it
- * doesn't work yet. See feature request # 425722
- *
- * Revision 1.2 2001/05/22 17:43:35 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Many minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.1.1.1 2001/05/15 13:58:45 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
@TOP@
/*
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: actionlist.h,v $
- * Revision 1.35 2008/09/19 15:43:54 fabiankeil
- * Fix sorting.
- *
- * Revision 1.34 2008/09/19 15:26:28 fabiankeil
- * Add change-x-forwarded-for{} action to block or add
- * X-Forwarded-For headers. Mostly based on code removed
- * before 3.0.7.
- *
- * Revision 1.33 2008/03/29 12:13:45 fabiankeil
- * Remove send-wafer and send-vanilla-wafer actions.
- *
- * Revision 1.32 2008/03/28 15:13:42 fabiankeil
- * Remove inspect-jpegs action.
- *
- * Revision 1.31 2008/03/27 18:27:20 fabiankeil
- * Remove kill-popups action.
- *
- * Revision 1.30 2008/03/04 18:30:34 fabiankeil
- * Remove the treat-forbidden-connects-like-blocks action. We now
- * use the "blocked" page for forbidden CONNECT requests by default.
- *
- * Revision 1.29 2008/03/01 14:00:43 fabiankeil
- * Let the block action take the reason for the block
- * as argument and show it on the "blocked" page.
- *
- * Revision 1.28 2007/12/11 21:08:29 fabiankeil
- * Let the CGI editor suggest a forward-override
- * parameter whose syntax is actually valid.
- *
- * Revision 1.27 2007/11/10 15:04:08 fabiankeil
- * Tell the CGI editor about +hide-referrer{conditional-forge}.
- *
- * Revision 1.26 2007/06/01 16:54:28 fabiankeil
- * Add forward-override{} to change the forwarding settings through
- * action sections. This is mainly interesting to forward different
- * clients differently (for example based on User-Agent or request
- * origin).
- *
- * Revision 1.25 2007/04/15 16:39:20 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.24 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.23 2006/10/09 10:26:18 fabiankeil
- * Changed the path in set-image-blocker's redirection default to
- * "send-banner?type=pattern" instead of "show-banner?type=pattern"
- * which isn't caught by Privoxy. Fixes BR 1573468.
- *
- * Changed hide-user-agent's default value to "Privoxy VERSION".
- *
- * Changed hide-referrer's default fake value to "http://www.privoxy.org/".
- * A static referrer is obviously fake anyway, so we might as well
- * advertise ourselves.
- *
- * Revision 1.22 2006/09/01 17:14:18 hal9
- * Re-ordered the actions list so that they display in the actions editor in
- * alphabetical order. Some of the new actions were "out of order".
- *
- * Revision 1.21 2006/08/14 08:25:19 fabiankeil
- * Split filter-headers{} into filter-client-headers{}
- * and filter-server-headers{}.
- * Added parse_header_time() to share some code.
- * Replaced timegm() with mktime().
- *
- * Revision 1.20 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.19 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.17.2.3 2004/10/03 12:53:32 david__schmidt
- * Add the ability to check jpeg images for invalid
- * lengths of comment blocks. Defensive strategy
- * against the exploit:
- * Microsoft Security Bulletin MS04-028
- * Buffer Overrun in JPEG Processing (GDI+) Could
- * Allow Code Execution (833987)
- * Enabled with +inspect-jpegs in actions files.
- *
- * Revision 1.17.2.2 2002/09/25 15:25:25 oes
- * Added more aliases for prehistoric action names
- *
- * Revision 1.17.2.1 2002/08/02 12:50:47 oes
- * Consistency with docs: Change default name for action from hide-referer to hide-referrer
- *
- * Revision 1.17 2002/05/14 21:25:55 oes
- * Renamed prevent-(setting/reading)-cookies to crunch-(incoming/outgoing)-cookies
- *
- * Revision 1.16 2002/04/24 02:15:18 oes
- * Renamed actions as discussed, Aliased old action names to new ones.
- *
- * Revision 1.15 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.14 2002/03/24 16:32:08 jongfoster
- * Removing logo option
- *
- * Revision 1.13 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.12 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.11 2002/03/12 01:42:49 oes
- * Introduced modular filters
- *
- * Revision 1.10 2002/03/08 18:19:14 jongfoster
- * Adding +image-blocker{pattern} option to edit interface
- *
- * Revision 1.9 2001/11/22 21:58:41 jongfoster
- * Adding action +no-cookies-keep
- *
- * Revision 1.8 2001/10/10 16:42:52 oes
- * Fixed a bug, Added +limit-connect string action
- *
- * Revision 1.7 2001/10/07 15:33:59 oes
- * Introduced a +no-compression action
- * Introduced a +downgrade action
- *
- * Revision 1.6 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- * Revision 1.5 2001/07/18 12:27:03 oes
- * Changed deanimate-gifs to string action
- *
- * Revision 1.4 2001/07/13 13:52:12 oes
- * - Formatting
- * - Introduced new action ACTION_DEANIMATE
- *
- * Revision 1.3 2001/06/07 23:03:56 jongfoster
- * Added standard comment at top of file.
- *
- *
*********************************************************************/
-\f
+
#if !(defined(DEFINE_ACTION_BOOL) && defined(DEFINE_ACTION_MULTI) && defined(DEFINE_ACTION_STRING))
#error Please define lots of macros before including "actionlist.h".
-const char actions_rcs[] = "$Id: actions.c,v 1.56 2009/03/08 14:19:21 fabiankeil Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.57 2009/04/04 18:13:51 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: actions.c,v $
- * Revision 1.56 2009/03/08 14:19:21 fabiankeil
- * Fix justified (but harmless) compiler warnings
- * on platforms where sizeof(int) < sizeof(long).
- *
- * Revision 1.55 2008/12/04 18:18:56 fabiankeil
- * Fix some cparser warnings.
- *
- * Revision 1.54 2008/09/20 10:04:33 fabiankeil
- * Remove hide-forwarded-for-headers action which has
- * been obsoleted by change-x-forwarded-for{block}.
- *
- * Revision 1.53 2008/05/26 16:04:04 fabiankeil
- * s@memorey@memory@
- *
- * Revision 1.52 2008/04/27 16:26:59 fabiankeil
- * White space fix for the last commit.
- *
- * Revision 1.51 2008/04/27 16:20:19 fabiankeil
- * Complain about every block action without reason found.
- *
- * Revision 1.50 2008/03/30 14:52:00 fabiankeil
- * Rename load_actions_file() and load_re_filterfile()
- * as they load multiple files "now".
- *
- * Revision 1.49 2008/03/29 12:13:45 fabiankeil
- * Remove send-wafer and send-vanilla-wafer actions.
- *
- * Revision 1.48 2008/03/28 18:17:14 fabiankeil
- * In action_used_to_be_valid(), loop through an array of formerly
- * valid actions instead of using an OR-chain of strcmpic() calls.
- *
- * Revision 1.47 2008/03/28 15:13:37 fabiankeil
- * Remove inspect-jpegs action.
- *
- * Revision 1.46 2008/03/27 18:27:20 fabiankeil
- * Remove kill-popups action.
- *
- * Revision 1.45 2008/03/24 11:21:02 fabiankeil
- * Share the action settings for multiple patterns in the same
- * section so we waste less memory for gigantic block lists
- * (and load them slightly faster). Reported by Franz Schwartau.
- *
- * Revision 1.44 2008/03/04 18:30:34 fabiankeil
- * Remove the treat-forbidden-connects-like-blocks action. We now
- * use the "blocked" page for forbidden CONNECT requests by default.
- *
- * Revision 1.43 2008/03/01 14:00:43 fabiankeil
- * Let the block action take the reason for the block
- * as argument and show it on the "blocked" page.
- *
- * Revision 1.42 2008/02/09 15:15:38 fabiankeil
- * List active and inactive actions in the show-url-info's
- * "Final results" section separately. Patch submitted by Lee
- * in #1830056, modified to list active actions first.
- *
- * Revision 1.41 2008/01/28 20:17:40 fabiankeil
- * - Mark some parameters as immutable.
- * - Hide update_action_bits_for_all_tags() while it's unused.
- *
- * Revision 1.40 2007/05/21 10:26:50 fabiankeil
- * - Use strlcpy() instead of strcpy().
- * - Provide a reason why loading the actions
- * file might have failed.
- *
- * Revision 1.39 2007/04/17 18:21:45 fabiankeil
- * Split update_action_bits() into
- * update_action_bits_for_all_tags()
- * and update_action_bits_for_tag().
- *
- * Revision 1.38 2007/04/15 16:39:20 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.37 2007/03/11 15:56:12 fabiankeil
- * Add kludge to log unknown aliases and actions before exiting.
- *
- * Revision 1.36 2006/12/28 17:15:42 fabiankeil
- * Fix gcc43 conversion warning.
- *
- * Revision 1.35 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.32.2.6 2006/01/29 23:10:56 david__schmidt
- * Multiple filter file support
- *
- * Revision 1.32.2.5 2005/06/09 01:18:41 david__schmidt
- * Tweaks to conditionally include pthread.h if FEATURE_PTHREAD is enabled -
- * this becomes important when jcc.h gets included later down the line.
- *
- * Revision 1.32.2.4 2003/12/03 10:33:11 oes
- * - Implemented Privoxy version requirement through
- * for-privoxy-version= statement in {{settings}}
- * block
- * - Fix for unchecked out-of-memory condition
- *
- * Revision 1.32.2.3 2003/02/28 12:52:10 oes
- * Fixed memory leak reported by Dan Price in Bug #694713
- *
- * Revision 1.32.2.2 2002/11/20 14:36:55 oes
- * Extended unload_current_actions_file() to multiple AFs.
- * Thanks to Oliver Stoeneberg for the hint.
- *
- * Revision 1.32.2.1 2002/05/26 12:13:16 roro
- * Change unsigned to unsigned long in actions_name struct. This closes
- * SourceForge Bug #539284.
- *
- * Revision 1.32 2002/05/12 21:36:29 jongfoster
- * Correcting function comments
- *
- * Revision 1.31 2002/05/06 07:56:50 oes
- * Made actions_to_html independent of FEATURE_CGI_EDIT_ACTIONS
- *
- * Revision 1.30 2002/04/30 11:14:52 oes
- * Made csp the first parameter in *action_to_html
- *
- * Revision 1.29 2002/04/26 19:30:54 jongfoster
- * - current_action_to_html(): Adding help link for the "-" form of
- * one-string actions.
- * - Some actions had "<br>-", some "<br> -" (note the space).
- * Standardizing on no space.
- * - Greatly simplifying some of the code by using string_join()
- * where appropriate.
- *
- * Revision 1.28 2002/04/26 12:53:15 oes
- * - CGI AF editor now writes action lines split into
- * single lines with line continuation
- * - actions_to_html now embeds each action name in
- * link to chapter
- * - current_action_to_text is now called current_action_to_html
- * and acts like actions_to_html
- *
- * Revision 1.27 2002/04/24 02:10:31 oes
- * - Jon's patch for multiple AFs:
- * - split load_actions_file, add load_one_actions_file
- * - make csp->actions_list files an array
- * - remember file id with each action
- * - Copy_action now frees dest action before copying
- *
- * Revision 1.26 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.25 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.24 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.23 2002/03/07 03:46:16 oes
- * Fixed compiler warnings
- *
- * Revision 1.22 2002/01/21 00:27:02 jongfoster
- * Allowing free_action(NULL).
- * Moving the functions that #include actionlist.h to the end of the file,
- * because the Visual C++ 97 debugger gets extremely confused if you try
- * to debug any code that comes after them in the file.
- *
- * Revision 1.21 2002/01/17 20:54:44 jongfoster
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Revision 1.20 2001/11/22 21:56:49 jongfoster
- * Making action_spec->flags into an unsigned long rather than just an
- * unsigned int.
- * Fixing a bug in the display of -add-header and -wafer
- *
- * Revision 1.19 2001/11/13 00:14:07 jongfoster
- * Fixing stupid bug now I've figured out what || means.
- * (It always returns 0 or 1, not one of it's paramaters.)
- *
- * Revision 1.18 2001/11/07 00:06:06 steudten
- * Add line number in error output for lineparsing for
- * actionsfile.
- *
- * Revision 1.17 2001/10/25 03:40:47 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.16 2001/10/23 21:30:30 jongfoster
- * Adding error-checking to selected functions.
- *
- * Revision 1.15 2001/10/14 21:58:22 jongfoster
- * Adding support for the CGI-based editor:
- * - Exported get_actions()
- * - Added new function free_alias_list()
- * - Added support for {{settings}} and {{description}} blocks
- * in the actions file. They are currently ignored.
- * - Added restriction to only one {{alias}} block which must appear
- * first in the file, to simplify the editor's rewriting rules.
- * - Note that load_actions_file() is no longer used by the CGI-based
- * editor, but some of the other routines in this file are.
- *
- * Revision 1.14 2001/09/22 16:36:59 jongfoster
- * Removing unused parameter fs from read_config_line()
- *
- * Revision 1.13 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- * Revision 1.12 2001/09/16 13:21:27 jongfoster
- * Changes to use new list functions.
- *
- * Revision 1.11 2001/09/14 00:17:32 jongfoster
- * Tidying up memory allocation. New function init_action().
- *
- * Revision 1.10 2001/09/10 10:14:34 oes
- * Removing unused variable
- *
- * Revision 1.9 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.8 2001/06/29 13:19:52 oes
- * Removed logentry from cancelled commit
- *
- * Revision 1.7 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.6 2001/06/07 23:04:34 jongfoster
- * Made get_actions() static.
- *
- * Revision 1.5 2001/06/03 19:11:48 oes
- * adapted to new enlist_unique arg format
- *
- * Revision 1.4 2001/06/01 20:03:42 jongfoster
- * Better memory management - current_action->strings[] now
- * contains copies of the strings, not the original.
- *
- * Revision 1.3 2001/06/01 18:49:17 jongfoster
- * Replaced "list_share" with "list" - the tiny memory gain was not
- * worth the extra complexity.
- *
- * Revision 1.2 2001/05/31 21:40:00 jongfoster
- * Removing some commented out, obsolete blocks of code.
- *
- * Revision 1.1 2001/05/31 21:16:46 jongfoster
- * Moved functions to process the action list into this new file.
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef ACTIONS_H_INCLUDED
#define ACTIONS_H_INCLUDED
-#define ACTIONS_H_VERSION "$Id: actions.h,v 1.17 2008/01/28 20:17:40 fabiankeil Exp $"
+#define ACTIONS_H_VERSION "$Id: actions.h,v 1.18 2008/03/30 14:52:00 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: actions.h,v $
- * Revision 1.17 2008/01/28 20:17:40 fabiankeil
- * - Mark some parameters as immutable.
- * - Hide update_action_bits_for_all_tags() while it's unused.
- *
- * Revision 1.16 2007/04/17 18:21:45 fabiankeil
- * Split update_action_bits() into
- * update_action_bits_for_all_tags()
- * and update_action_bits_for_tag().
- *
- * Revision 1.15 2007/04/15 16:39:20 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.14 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.12 2002/05/06 07:56:50 oes
- * Made actions_to_html independent of FEATURE_CGI_EDIT_ACTIONS
- *
- * Revision 1.11 2002/04/30 11:14:52 oes
- * Made csp the first parameter in *action_to_html
- *
- * Revision 1.10 2002/04/26 12:53:33 oes
- * - actions_to_html signature change
- * - current_action_to_text: renamed to current_action_to_html
- * and signature change
- *
- * Revision 1.9 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.8 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.7 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.6 2001/10/23 21:30:30 jongfoster
- * Adding error-checking to selected functions.
- *
- * Revision 1.5 2001/10/14 21:58:22 jongfoster
- * Adding support for the CGI-based editor:
- * - Exported get_actions()
- * - Added new function free_alias_list()
- * - Added support for {{settings}} and {{description}} blocks
- * in the actions file. They are currently ignored.
- * - Added restriction to only one {{alias}} block which must appear
- * first in the file, to simplify the editor's rewriting rules.
- * - Note that load_actions_file() is no longer used by the CGI-based
- * editor, but some of the other routines in this file are.
- *
- * Revision 1.4 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- * Revision 1.3 2001/09/14 00:17:32 jongfoster
- * Tidying up memory allocation. New function init_action().
- *
- * Revision 1.2 2001/07/29 19:01:11 jongfoster
- * Changed _FILENAME_H to FILENAME_H_INCLUDED.
- * Added forward declarations for needed structures.
- *
- * Revision 1.1 2001/05/31 21:16:46 jongfoster
- * Moved functions to process the action list into this new file.
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char amiga_rcs[] = "$Id: amiga.c,v 1.11 2006/07/18 14:48:45 david__schmidt Exp $";
+const char amiga_rcs[] = "$Id: amiga.c,v 1.12 2007/01/07 07:40:52 joergs Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/amiga.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: amiga.c,v $
- * Revision 1.11 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.9 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.8 2002/03/25 19:32:15 joergs
- * Name in version string changed from junkbuster to Privoxy.
- *
- * Revision 1.7 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.6 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.5 2002/03/03 09:18:03 joergs
- * Made jumbjuster work on AmigaOS again.
- *
- * Revision 1.4 2001/10/07 15:35:13 oes
- * Replaced 6 boolean members of csp with one bitmap (csp->flags)
- *
- * Revision 1.3 2001/09/12 22:54:51 joergs
- * Stacksize of main thread increased.
- *
- * Revision 1.2 2001/05/23 00:13:58 joergs
- * AmigaOS support fixed.
- *
- * Revision 1.1.1.1 2001/05/15 13:58:46 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifdef AMIGA
#ifndef AMIGA_H_INCLUDED
#define AMIGA_H_INCLUDED
-#define AMIGA_H_VERSION "$Id: amiga.h,v 1.11 2006/07/18 14:48:45 david__schmidt Exp $"
+#define AMIGA_H_VERSION "$Id: amiga.h,v 1.12 2007/01/07 07:40:52 joergs Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/amiga.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: amiga.h,v $
- * Revision 1.11 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.9 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.8 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.7 2002/03/03 09:18:03 joergs
- * Made jumbjuster work on AmigaOS again.
- *
- * Revision 1.6 2001/10/13 12:46:08 joergs
- * Added #undef EINTR to avoid warnings
- *
- * Revision 1.5 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.4 2001/05/29 20:05:06 joergs
- * Fixed exit() macro not exiting if called before InitAmiga()
- * (junkbuster --help and --version).
- *
- * Revision 1.3 2001/05/25 21:53:27 jongfoster
- * Fixing indentation
- *
- * Revision 1.2 2001/05/23 00:13:58 joergs
- * AmigaOS support fixed.
- *
- * Revision 1.1.1.1 2001/05/15 13:58:46 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#define _KERNEL
#include <sys/socket.h>
-const char cgi_rcs[] = "$Id: cgi.c,v 1.115 2009/03/01 18:28:23 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.116 2009/03/15 14:59:34 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: cgi.c,v $
- * Revision 1.115 2009/03/01 18:28:23 fabiankeil
- * Help clang understand that we aren't dereferencing
- * NULL pointers here.
- *
- * Revision 1.114 2008/12/04 18:15:04 fabiankeil
- * Fix some cparser warnings.
- *
- * Revision 1.113 2008/09/04 08:13:58 fabiankeil
- * Prepare for critical sections on Windows by adding a
- * layer of indirection before the pthread mutex functions.
- *
- * Revision 1.112 2008/08/31 16:08:12 fabiankeil
- * "View the request headers" isn't more equal than the other
- * menu items and thus doesn't need a trailing dot either.
- *
- * Revision 1.111 2008/08/31 15:59:02 fabiankeil
- * There's no reason to let remote toggling support depend
- * on FEATURE_CGI_EDIT_ACTIONS, so make sure it doesn't.
- *
- * Revision 1.110 2008/08/31 14:55:43 fabiankeil
- * Add a @date@ symbol to include a date(1)-like time string
- * in templates. Modified version of the patch Endre Szabo
- * submitted in #2026468.
- *
- * Revision 1.109 2008/07/26 09:40:27 fabiankeil
- * Remove the unconditional block in get_http_time().
- * It's pointless now that it's no longer used to limit
- * dummy's scope. While at it, remove obvious comments
- * and a trailing space.
- *
- * Revision 1.108 2008/05/26 17:30:53 fabiankeil
- * Provide an OpenSearch Description to access the
- * show-url-info page through "search engine plugins".
- *
- * Revision 1.107 2008/05/26 16:23:19 fabiankeil
- * - Fix spelling in template-not-found message.
- * - Declare referrer_is_safe()'s alternative_prefix[] static.
- *
- * Revision 1.106 2008/05/21 15:24:38 fabiankeil
- * Mark csp as immutable for a bunch of functions.
- *
- * Revision 1.105 2008/04/17 14:40:47 fabiankeil
- * Provide get_http_time() with the buffer size so it doesn't
- * have to blindly assume that the buffer is big enough.
- *
- * Revision 1.104 2008/03/26 18:07:06 fabiankeil
- * Add hostname directive. Closes PR#1918189.
- *
- * Revision 1.103 2008/03/21 11:13:57 fabiankeil
- * Only gather host information if it's actually needed.
- * Also move the code out of accept_connection() so it's less likely
- * to delay other incoming connections if the host is misconfigured.
- *
- * Revision 1.102 2008/02/23 16:33:43 fabiankeil
- * Let forward_url() use the standard parameter ordering
- * and mark its second parameter immutable.
- *
- * Revision 1.101 2008/02/03 15:45:06 fabiankeil
- * Add SOCKS5 support for "Forwarding failure" CGI page.
- *
- * Revision 1.100 2007/10/17 18:40:53 fabiankeil
- * - Send CGI pages as HTTP/1.1 unless the client asked for HTTP/1.0.
- * - White space fix.
- *
- * Revision 1.99 2007/08/05 13:42:22 fabiankeil
- * #1763173 from Stefan Huehner: declare some more functions static.
- *
- * Revision 1.98 2007/05/14 10:33:51 fabiankeil
- * - Use strlcpy() and strlcat() instead of strcpy() and strcat().
- *
- * Revision 1.97 2007/04/09 18:11:35 fabiankeil
- * Don't mistake VC++'s _snprintf() for a snprintf() replacement.
- *
- * Revision 1.96 2007/03/08 17:41:05 fabiankeil
- * Use sizeof() more often.
- *
- * Revision 1.95 2007/02/10 17:01:37 fabiankeil
- * Don't overlook map result for the forwarding-type.
- *
- * Revision 1.94 2007/02/08 19:44:49 fabiankeil
- * Use a transparent background for the PNG replacement pattern.
- *
- * Revision 1.93 2007/02/07 10:45:22 fabiankeil
- * - Save the reason for generating http_responses.
- * - Fix --disable-toggle (again).
- * - Use TBL birthday hack for 403 responses as well.
- * - Uglify the @menu@ again to fix JavaScript
- * errors on the "blocked" template.
- * - Escape an ampersand in cgi_error_unknown().
- *
- * Revision 1.92 2007/01/28 13:41:17 fabiankeil
- * - Add HEAD support to finish_http_response.
- * - Add error favicon to internal HTML error messages.
- *
- * Revision 1.91 2007/01/27 13:09:16 fabiankeil
- * Add new config option "templdir" to
- * change the templates directory.
- *
- * Revision 1.90 2007/01/25 13:47:26 fabiankeil
- * Added "forwarding-failed" template support for error_response().
- *
- * Revision 1.89 2007/01/23 15:51:16 fabiankeil
- * Add favicon delivery functions.
- *
- * Revision 1.88 2007/01/23 13:14:32 fabiankeil
- * - Map variables that aren't guaranteed to be
- * pure ASCII html_encoded.
- * - Use CGI_PREFIX to generate URL for user manual
- * CGI page to make sure CGI_SITE_2_PATH is included.
- *
- * Revision 1.87 2007/01/22 15:34:13 fabiankeil
- * - "Protect" against a rather lame JavaScript-based
- * Privoxy detection "attack" and check the referrer
- * before delivering the CGI style sheet.
- * - Move referrer check for unsafe CGI pages into
- * referrer_is_safe() and log the result.
- * - Map @url@ in cgi-error-disabled page.
- * It's required for the "go there anyway" link.
- * - Mark *csp as immutable for grep_cgi_referrer().
- *
- * Revision 1.86 2007/01/09 11:54:26 fabiankeil
- * Fix strdup() error handling in cgi_error_unknown()
- * and cgi_error_no_template(). Reported by Markus Elfring.
- *
- * Revision 1.85 2007/01/05 14:19:02 fabiankeil
- * Handle pcrs_execute() errors in template_fill() properly.
- *
- * Revision 1.84 2006/12/28 17:54:22 fabiankeil
- * Fixed gcc43 conversion warnings and replaced sprintf
- * calls with snprintf to give OpenBSD's gcc one less reason
- * to complain.
- *
- * Revision 1.83 2006/12/17 19:35:19 fabiankeil
- * Escape ampersand in Privoxy menu.
- *
- * Revision 1.82 2006/12/17 17:53:39 fabiankeil
- * Suppress the toggle link if remote toggling is disabled.
- *
- * Revision 1.81 2006/12/09 13:49:16 fabiankeil
- * Fix configure option --disable-toggle.
- * Thanks to Peter Thoenen for reporting this.
- *
- * Revision 1.80 2006/12/08 14:45:32 fabiankeil
- * Don't lose the FORCE_PREFIX in case of
- * connection problems. Fixes #612235.
- *
- * Revision 1.79 2006/11/13 19:05:50 fabiankeil
- * Make pthread mutex locking more generic. Instead of
- * checking for OSX and OpenBSD, check for FEATURE_PTHREAD
- * and use mutex locking unless there is an _r function
- * available. Better safe than sorry.
- *
- * Fixes "./configure --disable-pthread" and should result
- * in less threading-related problems on pthread-using platforms,
- * but it still doesn't fix BR#1122404.
- *
- * Revision 1.78 2006/09/21 19:22:07 fabiankeil
- * Use CGI_PREFIX to check the referrer.
- * The check for "http://config.privoxy.org/" fails
- * if the user modified CGI_SITE_2_HOST.
- *
- * Revision 1.77 2006/09/21 15:17:23 fabiankeil
- * Adjusted headers for Privoxy's cgi responses:
- * Don't set Last-Modified, Expires and Cache-Control
- * headers for redirects; always set "Connection: close".
- *
- * Revision 1.76 2006/09/07 14:06:38 fabiankeil
- * Only predate the Last-Modified header for cgi responses
- * that are delivered with status code 404 or 503.
- *
- * Revision 1.75 2006/09/07 11:56:39 fabiankeil
- * Mark cgi_send_user_manual as harmless,
- * to fix the access denied problem Hal spotted.
- * The manual has no secret content, therefore we
- * don't have to care about "secure" referrers.
- *
- * Revision 1.74 2006/09/06 18:45:03 fabiankeil
- * Incorporate modified version of Roland Rosenfeld's patch to
- * optionally access the user-manual via Privoxy. Closes patch 679075.
- *
- * Formatting changed to Privoxy style, added call to
- * cgi_error_no_template if the requested file doesn't
- * exist and modified check whether or not Privoxy itself
- * should serve the manual. Should work cross-platform now.
- *
- * Revision 1.73 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.72 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.70.2.13 2004/02/17 13:30:23 oes
- * Moved cgi_error_disabled() from cgiedit.c to
- * cgi.c to re-enable build with --disable-editor.
- * Fixes Bug #892744. Thanks to Matthew Fischer
- * for spotting.
- *
- * Revision 1.70.2.12 2003/12/17 16:33:16 oes
- * - Added new function cgi_redirect to handle creation of
- * HTTP redirect messages formerly repeated in the code.
- * - Send cgi_error_disabled instead of cgi_error_404 when
- * referrer check fails
- * - Dynamic content now gets Expires header field with date
- * in the past
- *
- * Revision 1.70.2.11 2003/10/23 12:29:26 oes
- * Bugfix: Transparent PNG was not transparent. Thanks to
- * Dan Razzell of Starfish Systems for notice and new PNG.
- *
- * Revision 1.70.2.10 2003/06/06 07:54:25 oes
- * Security fix: dspatch_known_cgi no longer considers an empty
- * referrer safe for critical CGIs, since malicious links could
- * reside on https:// locations which browsers don't advertize as
- * referrers. Closes bug #749916, thanks to Jeff Epler for the
- * hint. Goodbye One-Click[tm] toggling :-(
- *
- * Revision 1.70.2.9 2003/05/08 15:11:31 oes
- * Nit
- *
- * Revision 1.70.2.8 2003/04/29 13:33:51 oes
- * Killed a compiler warning on OSX
- *
- * Revision 1.70.2.7 2003/04/03 13:50:58 oes
- * - Don't call cgi_error_disabled ifndef FEATURE_CGI_EDIT_ACTIONS
- * (fixes bug #710056)
- * - Show toggle info only if we have it
- *
- * Revision 1.70.2.6 2003/03/12 01:26:25 david__schmidt
- * Move declaration of struct tm dummy outside of a control block so it is
- * accessible later on during snprintf in get_http_time.
- *
- * Revision 1.70.2.5 2003/03/11 11:53:58 oes
- * Cosmetic: Renamed cryptic variable
- *
- * Revision 1.70.2.4 2003/03/07 03:41:03 david__schmidt
- * Wrapping all *_r functions (the non-_r versions of them) with mutex semaphores for OSX. Hopefully this will take care of all of those pesky crash reports.
- *
- * Revision 1.70.2.3 2002/11/28 18:14:32 oes
- * Disable access to critical CGIs via untrusted referrers.
- * This prevents users from being tricked by malicious websites
- * into making unintentional configuration changes:
- *
- * - Added flag to each cgi_dispatcher that allows or denies
- * external linking
- * - Introduced proviorical function that greps for the
- * referrer header before regular header parsing happens
- * - Added safety check to dispatch_known_cgi. CGI is called
- * if (cgi harmless || no referrer || we are referrer).
- * Else a) toggle calls are modified not to change status and
- * b) all other calls are denied.
- *
- * Revision 1.70.2.2 2002/11/12 16:20:37 oes
- * Added missing #ifdef FEATURE_TOGGLE around g_bToggleIJB; fixes bug #636651
- *
- * Revision 1.70.2.1 2002/08/05 11:17:46 oes
- * Fixed Bug #587820, i.e. added workaround for IE bug that includes fragment identifier in (cgi) query
- *
- * Revision 1.70 2002/05/19 11:33:20 jongfoster
- * If a CGI error was not handled, and propogated back to
- * dispatch_known_cgi(), then it was assumed to be "out of memory".
- * This gave a very misleading error message.
- *
- * Now other errors will cause a simple message giving the error
- * number and asking the user to report a bug.
- *
- * Bug report:
- * http://sourceforge.net/tracker/index.php?func=detail
- * &aid=557905&group_id=11118&atid=111118
- *
- * Revision 1.69 2002/05/14 21:28:40 oes
- * - Fixed add_help_link to link to the (now split) actions
- * part of the config chapter
- * - Renamed helplink export to actions-help-prefix
- *
- * Revision 1.68 2002/05/12 21:36:29 jongfoster
- * Correcting function comments
- *
- * Revision 1.67 2002/04/30 12:02:07 oes
- * Nit: updated a comment
- *
- * Revision 1.66 2002/04/26 18:32:57 jongfoster
- * Fixing a memory leak on error
- *
- * Revision 1.65 2002/04/26 12:53:51 oes
- * - New function add_help_link
- * - default_exports now exports links to the user manual
- * and a prefix for links into the config chapter
- *
- * Revision 1.64 2002/04/24 02:17:21 oes
- * - Better descriptions for CGIs
- * - Hide edit-actions, more shortcuts
- * - Moved get_char_param, get_string_param and get_number_param here
- * from cgiedit.c
- *
- * Revision 1.63 2002/04/15 19:06:43 jongfoster
- * Typos
- *
- * Revision 1.62 2002/04/10 19:59:46 jongfoster
- * Fixes to #include in templates:
- * - Didn't close main file if loading an included template fails.
- * - I'm paranoid and want to disallow "#include /etc/passwd".
- *
- * Revision 1.61 2002/04/10 13:37:48 oes
- * Made templates modular: template_load now recursive with max depth 1
- *
- * Revision 1.60 2002/04/08 20:50:25 swa
- * fixed JB spelling
- *
- * Revision 1.59 2002/04/05 15:51:51 oes
- * - added send-stylesheet CGI
- * - bugfix: error-pages now get correct request protocol
- * - fixed
- * - kludged CGI descriptions and menu not to break JS syntax
- *
- * Revision 1.58 2002/03/29 03:33:13 david__schmidt
- * Fix Mac OSX compiler warnings
- *
- * Revision 1.57 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.56 2002/03/24 17:50:46 jongfoster
- * Fixing compile error if actions file editor disabled
- *
- * Revision 1.55 2002/03/24 16:55:06 oes
- * Making GIF checkerboard transparent
- *
- * Revision 1.54 2002/03/24 16:18:15 jongfoster
- * Removing old logo
- *
- * Revision 1.53 2002/03/24 16:06:00 oes
- * Correct transparency for checkerboard PNG. Thanks, Magnus!
- *
- * Revision 1.52 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.51 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.50 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.49 2002/03/13 00:27:04 jongfoster
- * Killing warnings
- *
- * Revision 1.48 2002/03/08 17:47:07 jongfoster
- * Adding comments
- *
- * Revision 1.47 2002/03/08 16:41:33 oes
- * Added GIF images again
- *
- * Revision 1.46 2002/03/07 03:48:38 oes
- * - Changed built-in images from GIF to PNG
- * (with regard to Unisys patent issue)
- * - Added a 4x4 pattern PNG which is less intrusive
- * than the logo but also clearly marks the deleted banners
- *
- * Revision 1.45 2002/03/06 22:54:35 jongfoster
- * Automated function-comment nitpicking.
- *
- * Revision 1.44 2002/03/05 22:43:45 david__schmidt
- * - Better error reporting on OS/2
- * - Fix double-slash comment (oops)
- *
- * Revision 1.43 2002/03/05 21:33:45 david__schmidt
- * - Re-enable OS/2 building after new parms were added
- * - Fix false out of memory report when resolving CGI templates when no IP
- * address is available of failed attempt (a la no such domain)
- *
- * Revision 1.42 2002/01/21 00:33:20 jongfoster
- * Replacing strsav() with the safer string_append() or string_join().
- * Adding map_block_keep() to save a few bytes in the edit-actions-list HTML.
- * Adding missing html_encode() to error message generators.
- * Adding edit-actions-section-swap and many "shortcuts" to the list of CGIs.
- *
- * Revision 1.41 2002/01/17 20:56:22 jongfoster
- * Replacing hard references to the URL of the config interface
- * with #defines from project.h
- *
- * Revision 1.40 2002/01/09 14:26:46 oes
- * Added support for thread-safe gmtime_r call.
- *
- * Revision 1.39 2001/11/16 00:48:13 jongfoster
- * Fixing a compiler warning
- *
- * Revision 1.38 2001/11/13 00:31:21 jongfoster
- * - Adding new CGIs for use by non-JavaScript browsers:
- * edit-actions-url-form
- * edit-actions-add-url-form
- * edit-actions-remove-url-form
- * - Fixing make_menu()'s HTML generation - it now quotes the href parameter.
- * - Fixing || bug.
- *
- * Revision 1.37 2001/11/01 14:28:47 david__schmidt
- * Show enablement/disablement status in almost all templates.
- * There is a little trickiness here: apparent recursive resolution of
- * @if-enabled-then@ caused the toggle template to show status out-of-phase with
- * the actual enablement status. So a similar construct,
- * @if-enabled-display-then@, is used to resolve the status display on non-'toggle'
- * templates.
- *
- * Revision 1.36 2001/10/26 17:33:27 oes
- * marginal bugfix
- *
- * Revision 1.35 2001/10/23 21:48:19 jongfoster
- * Cleaning up error handling in CGI functions - they now send back
- * a HTML error page and should never cause a FATAL error. (Fixes one
- * potential source of "denial of service" attacks).
- *
- * CGI actions file editor that works and is actually useful.
- *
- * Ability to toggle Junkbuster remotely using a CGI call.
- *
- * You can turn off both the above features in the main configuration
- * file, e.g. if you are running a multi-user proxy.
- *
- * Revision 1.34 2001/10/18 22:22:09 david__schmidt
- * Only show "Local support" on templates conditionally:
- * - if either 'admin-address' or 'proxy-info-url' are uncommented in config
- * - if not, no Local support section appears
- *
- * Revision 1.33 2001/10/14 22:28:41 jongfoster
- * Fixing stupid typo.
- *
- * Revision 1.32 2001/10/14 22:20:18 jongfoster
- * - Changes to CGI dispatching method to match CGI names exactly,
- * rather than doing a prefix match.
- * - No longer need to count the length of the CGI handler names by hand.
- * - Adding new handler for 404 error when disptching a CGI, if none of
- * the handlers match.
- * - Adding new handlers for CGI actionsfile editor.
- *
- * Revision 1.31 2001/10/10 10:56:39 oes
- * Failiure to load template now fatal. Before, the user got a hard-to-understand assertion failure from cgi.c
- *
- * Revision 1.30 2001/10/02 15:30:57 oes
- * Introduced show-request cgi
- *
- * Revision 1.29 2001/09/20 15:47:44 steudten
- *
- * Fix BUG: Modify int size to size_t size in fill_template()
- * - removes big trouble on machines where sizeof(int) != sizeof(size_t).
- *
- * Revision 1.28 2001/09/19 18:00:37 oes
- * - Deletef time() FIXME (Can't fail under Linux either, if
- * the argument is guaranteed to be in out address space,
- * which it is.)
- * - Fixed comments
- * - Pointer notation cosmetics
- * - Fixed a minor bug in template_fill(): Failiure of
- * pcrs_execute() now secure.
- *
- * Revision 1.27 2001/09/16 17:08:54 jongfoster
- * Moving simple CGI functions from cgi.c to new file cgisimple.c
- *
- * Revision 1.26 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- * Revision 1.25 2001/09/16 15:02:35 jongfoster
- * Adding i.j.b/robots.txt.
- * Inlining add_stats() since it's only ever called from one place.
- *
- * Revision 1.24 2001/09/16 11:38:01 jongfoster
- * Splitting fill_template() into 2 functions:
- * template_load() loads the file
- * template_fill() performs the PCRS regexps.
- * This is because the CGI edit interface has a "table row"
- * template which is used many times in the page - this
- * change means it's only loaded from disk once.
- *
- * Revision 1.23 2001/09/16 11:16:05 jongfoster
- * Better error handling in dispatch_cgi() and parse_cgi_parameters()
- *
- * Revision 1.22 2001/09/16 11:00:10 jongfoster
- * New function alloc_http_response, for symmetry with free_http_response
- *
- * Revision 1.21 2001/09/13 23:53:03 jongfoster
- * Support for both static and dynamically generated CGI pages.
- * Correctly setting Last-Modified: and Expires: HTTP headers.
- *
- * Revision 1.20 2001/09/13 23:40:36 jongfoster
- * (Cosmetic only) Indentation correction
- *
- * Revision 1.19 2001/09/13 23:31:25 jongfoster
- * Moving image data to cgi.c rather than cgi.h.
- *
- * Revision 1.18 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.17 2001/08/05 15:57:38 oes
- * Adapted finish_http_response to new list_to_text
- *
- * Revision 1.16 2001/08/01 21:33:18 jongfoster
- * Changes to fill_template() that reduce memory usage without having
- * an impact on performance. I also renamed some variables so as not
- * to clash with the C++ keywords "new" and "template".
- *
- * Revision 1.15 2001/08/01 21:19:22 jongfoster
- * Moving file version information to a separate CGI page.
- *
- * Revision 1.14 2001/08/01 00:19:03 jongfoster
- * New function: map_conditional() for an if-then-else syntax.
- * Changing to use new version of show_defines()
- *
- * Revision 1.13 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.12 2001/07/29 18:47:05 jongfoster
- * Adding missing #include "loadcfg.h"
- *
- * Revision 1.11 2001/07/18 17:24:37 oes
- * Changed to conform to new pcrs interface
- *
- * Revision 1.10 2001/07/13 13:53:13 oes
- * Removed all #ifdef PCRS and related code
- *
- * Revision 1.9 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.8 2001/06/29 13:21:46 oes
- * - Cosmetics: renamed and reordered functions, variables,
- * texts, improved comments etc
- *
- * - Removed ij_untrusted_url() The relevant
- * info is now part of the "untrusted" page,
- * which is generated by filters.c:trust_url()
- *
- * - Generators of content now call finish_http_response()
- * themselves, making jcc.c:chat() a little less
- * cluttered
- *
- * - Removed obsolete "Pragma: no-cache" from our headers
- *
- * - http_responses now know their head length
- *
- * - fill_template now uses the new interface to pcrs, so that
- * - long jobs (like whole files) no longer have to be assembled
- * in a fixed size buffer
- * - the new T (trivial) option is used, and the replacement may
- * contain Perl syntax backrefs without confusing pcrs
- *
- * - Introduced default_exports() which generates a set of exports
- * common to all CGIs and other content generators
- *
- * - Introduced convenience function map_block_killer()
- *
- * - Introduced convenience function make_menu()
- *
- * - Introduced CGI-like function error_response() which generates
- * the "No such domain" and "Connect failed" messages using the
- * CGI platform
- *
- * - cgi_show_url_info:
- * - adapted to new CGI features
- * - form and answers now generated from same template
- * - http:// prefix in URL now OK
- *
- * - cgi_show_status:
- * - adapted to new CGI features
- * - no longer uses csp->init_proxy_args
- *
- * - cgi_default:
- * - moved menu generation to make_menu()
- *
- * - add_stats now writes single export map entries instead
- * of a fixed string
- *
- * - Moved redirect_url() to filters.c
- *
- * - Fixed mem leak in free_http_response(), map_block_killer(),
- *
- * - Removed logentry from cancelled commit
- *
- * Revision 1.7 2001/06/09 10:51:58 jongfoster
- * Changing "show URL info" handler to new style.
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.6 2001/06/07 23:05:19 jongfoster
- * Removing code related to old forward and ACL files.
- *
- * Revision 1.5 2001/06/05 19:59:16 jongfoster
- * Fixing multiline character string (a GCC-only "feature"), and snprintf (it's _snprintf under VC++).
- *
- * Revision 1.4 2001/06/04 10:41:52 swa
- * show version string of cgi.h and cgi.c
- *
- * Revision 1.3 2001/06/03 19:12:16 oes
- * introduced new cgi handling
- *
- * No revisions before 1.3
- *
**********************************************************************/
-\f
+
#include "config.h"
#ifndef CGI_H_INCLUDED
#define CGI_H_INCLUDED
-#define CGI_H_VERSION "$Id: cgi.h,v 1.34 2008/04/17 14:40:48 fabiankeil Exp $"
+#define CGI_H_VERSION "$Id: cgi.h,v 1.35 2008/05/21 15:24:37 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: cgi.h,v $
- * Revision 1.34 2008/04/17 14:40:48 fabiankeil
- * Provide get_http_time() with the buffer size so it doesn't
- * have to blindly assume that the buffer is big enough.
- *
- * Revision 1.33 2007/01/28 13:41:17 fabiankeil
- * - Add HEAD support to finish_http_response.
- * - Add error favicon to internal HTML error messages.
- *
- * Revision 1.32 2006/12/17 17:53:39 fabiankeil
- * Suppress the toggle link if remote toggling is disabled.
- *
- * Revision 1.31 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.29.2.2 2004/02/17 13:30:23 oes
- * Moved cgi_error_disabled() from cgiedit.c to
- * cgi.c to re-enable build with --disable-editor.
- * Fixes Bug #892744. Thanks to Matthew Fischer
- * for spotting.
- *
- * Revision 1.29.2.1 2003/12/17 16:33:28 oes
- * Added prototype of new function cgi_redirect
- *
- * Revision 1.29 2002/05/19 11:33:21 jongfoster
- * If a CGI error was not handled, and propogated back to
- * dispatch_known_cgi(), then it was assumed to be "out of memory".
- * This gave a very misleading error message.
- *
- * Now other errors will cause a simple message giving the error
- * number and asking the user to report a bug.
- *
- * Bug report:
- * http://sourceforge.net/tracker/index.php?func=detail
- * &aid=557905&group_id=11118&atid=111118
- *
- * Revision 1.28 2002/04/26 12:54:03 oes
- * New function add_help_link
- *
- * Revision 1.27 2002/04/24 02:16:51 oes
- * Moved get_char_param, get_string_param and get_number_param here from cgiedit.c
- *
- * Revision 1.26 2002/04/10 13:38:35 oes
- * load_template signature changed
- *
- * Revision 1.25 2002/04/08 20:50:25 swa
- * fixed JB spelling
- *
- * Revision 1.24 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.23 2002/03/24 16:18:15 jongfoster
- * Removing old logo
- *
- * Revision 1.22 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.21 2002/03/07 03:48:38 oes
- * - Changed built-in images from GIF to PNG
- * (with regard to Unisys patent issue)
- * - Added a 4x4 pattern PNG which is less intrusive
- * than the logo but also clearly marks the deleted banners
- *
- * Revision 1.20 2002/03/04 17:53:22 oes
- * Fixed compiled warning
- *
- * Revision 1.19 2002/01/21 00:33:52 jongfoster
- * Adding map_block_keep() to save a few bytes in the edit-actions-list HTML.
- *
- * Revision 1.18 2001/11/16 00:46:31 jongfoster
- * Fixing compiler warnings
- *
- * Revision 1.17 2001/10/23 21:48:19 jongfoster
- * Cleaning up error handling in CGI functions - they now send back
- * a HTML error page and should never cause a FATAL error. (Fixes one
- * potential source of "denial of service" attacks).
- *
- * CGI actions file editor that works and is actually useful.
- *
- * Ability to toggle Junkbuster remotely using a CGI call.
- *
- * You can turn off both the above features in the main configuration
- * file, e.g. if you are running a multi-user proxy.
- *
- * Revision 1.16 2001/09/16 17:08:54 jongfoster
- * Moving simple CGI functions from cgi.c to new file cgisimple.c
- *
- * Revision 1.15 2001/09/16 15:02:35 jongfoster
- * Adding i.j.b/robots.txt.
- * Inlining add_stats() since it's only ever called from one place.
- *
- * Revision 1.14 2001/09/16 11:38:02 jongfoster
- * Splitting fill_template() into 2 functions:
- * template_load() loads the file
- * template_fill() performs the PCRS regexps.
- * This is because the CGI edit interface has a "table row"
- * template which is used many times in the page - this
- * change means it's only loaded from disk once.
- *
- * Revision 1.13 2001/09/16 11:00:10 jongfoster
- * New function alloc_http_response, for symmetry with free_http_response
- *
- * Revision 1.12 2001/09/13 23:31:25 jongfoster
- * Moving image data to cgi.c rather than cgi.h.
- *
- * Revision 1.11 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.10 2001/08/01 21:19:22 jongfoster
- * Moving file version information to a separate CGI page.
- *
- * Revision 1.9 2001/08/01 00:17:54 jongfoster
- * Adding prototype for map_conditional
- *
- * Revision 1.8 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.7 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.6 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.5 2001/06/29 13:22:44 oes
- * - Cleaned up
- * - Added new functions: default_exports(), make_menu(),
- * error_response() etc, ranamed others and changed
- * param and return types.
- * - Removed HTTP/HTML snipplets
- * - Removed logentry from cancelled commit
- *
- * Revision 1.4 2001/06/09 10:50:58 jongfoster
- * Changing "show URL info" handler to new style.
- * Adding "extern" to some function prototypes.
- *
- * Revision 1.3 2001/06/03 19:12:16 oes
- * introduced new cgi handling
- *
- * No revisions before 1.3
- *
**********************************************************************/
-\f
+
#include "project.h"
-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.64 2009/03/01 18:43:09 fabiankeil Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.65 2009/03/08 14:19:22 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: cgiedit.c,v $
- * Revision 1.64 2009/03/01 18:43:09 fabiankeil
- * Fix cparser warnings.
- *
- * Revision 1.63 2008/12/04 18:15:38 fabiankeil
- * Fix some cparser warnings.
- *
- * Revision 1.62 2008/08/31 15:59:02 fabiankeil
- * There's no reason to let remote toggling support depend
- * on FEATURE_CGI_EDIT_ACTIONS, so make sure it doesn't.
- *
- * Revision 1.61 2008/03/24 18:12:52 fabiankeil
- * Use sizeof() more often.
- *
- * Revision 1.60 2008/03/15 14:52:35 fabiankeil
- * Add CGI editor support for the "disable all filters of this type"
- * directives "-client-header-filter", "-server-header-filter",
- * "-client-header-tagger" and "-server-header-tagger".
- *
- * Revision 1.59 2008/03/08 16:25:56 fabiankeil
- * After three file modification time mismatches, turn the CGI editor off.
- *
- * Revision 1.58 2007/11/28 17:57:01 fabiankeil
- * Fix double free in cgi_edit_actions_list().
- * Reported by adlab in BR#1840145.
- *
- * Revision 1.57 2007/10/27 13:32:23 fabiankeil
- * Plug minor 5-year-old memory leak. Spotted by
- * Valgrind and triggered by Privoxy-Regression-Test.
- *
- * Revision 1.56 2007/08/05 13:47:03 fabiankeil
- * #1763173 from Stefan Huehner: s@const static@static const@.
- *
- * Revision 1.55 2007/05/31 11:50:20 fabiankeil
- * Re-enable support for old-school URLs like
- * http://config.privoxy.org/edit-actions-list?f=default
- * in the action editor.
- *
- * They are no longer used by the CGI pages, but make it easier
- * to reach the editor directly, without knowing the requested
- * file's index in csp->config->actions_file[].
- *
- * Revision 1.54 2007/05/14 10:33:51 fabiankeil
- * - Use strlcpy() and strlcat() instead of strcpy() and strcat().
- *
- * Revision 1.53 2007/04/15 16:39:20 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.52 2007/04/12 10:41:23 fabiankeil
- * - Don't mistake VC++'s _snprintf() for a snprintf() replacement.
- * - Move some cgi_edit_actions_for_url() variables into structs.
- * - Remove bogus comment.
- *
- * Revision 1.51 2007/04/08 13:21:05 fabiankeil
- * Reference action files in CGI URLs by id instead
- * of using the first part of the file name.
- * Fixes BR 1694250 and BR 1590556.
- *
- * Revision 1.50 2007/03/29 11:40:34 fabiankeil
- * Divide @filter-params@ into @client-header-filter-params@
- * @content-filter-params@ and @server-header-filter-params@.
- *
- * 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.
- *
- * Revision 1.47 2006/12/28 18:04:25 fabiankeil
- * Fixed gcc43 conversion warnings.
- *
- * Revision 1.46 2006/12/27 18:44:52 fabiankeil
- * Stop shadowing string.h's index().
- *
- * Revision 1.45 2006/12/21 12:57:48 fabiankeil
- * Add config option "split-large-forms"
- * to work around the browser bug reported
- * in BR #1570678.
- *
- * Revision 1.44 2006/12/09 13:49:16 fabiankeil
- * Fix configure option --disable-toggle.
- * Thanks to Peter Thoenen for reporting this.
- *
- * Revision 1.43 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.41.2.12 2006/01/30 15:16:25 david__schmidt
- * Remove a little residual debugging info
- *
- * Revision 1.41.2.11 2006/01/29 23:10:56 david__schmidt
- * Multiple filter file support
- *
- * Revision 1.41.2.10 2005/07/04 03:13:43 david__schmidt
- * Undo some damaging memory leak patches
- *
- * Revision 1.41.2.9 2005/07/04 00:31:04 david__schmidt
- * Removing a double free
- *
- * Revision 1.41.2.8 2005/05/07 21:50:54 david__schmidt
- * A few memory leaks plugged (mostly on error paths)
- *
- * Revision 1.41.2.7 2004/02/17 13:30:23 oes
- * Moved cgi_error_disabled() from cgiedit.c to
- * cgi.c to re-enable build with --disable-editor.
- * Fixes Bug #892744. Thanks to Matthew Fischer
- * for spotting.
- *
- * Revision 1.41.2.6 2003/12/18 08:13:48 oes
- * One line lost in last commit
- *
- * Revision 1.41.2.5 2003/12/17 16:33:47 oes
- * - All edit functions that redirect back to the list page
- * now use cgi_redirect
- * - All redirects now contain useless parameter "foo", whose
- * value are raw seconds since epoch, in order to force
- * Opera and Konqueror to properly reload the list. Closes
- * bug #859993
- *
- * Revision 1.41.2.4 2003/03/11 11:53:59 oes
- * Cosmetic: Renamed cryptic variable
- *
- * Revision 1.41.2.3 2002/11/12 15:01:41 oes
- * Fix: Don't free uninitialized struct editable_file
- *
- * Revision 1.41.2.2 2002/08/05 20:02:59 oes
- * Bugfix: "Insert new section at top" did not work properly if first non-comment line in file was of type FILE_LINE_ACTION
- *
- * Revision 1.41.2.1 2002/08/02 12:43:14 oes
- * Fixed bug #588514: first_time now set on a per-string basis in actions_from_radio; javascriptify now called on copies
- *
- * Revision 1.41 2002/05/21 19:09:45 oes
- * - Made Add/Edit/Remove URL Submit and Cancel
- * buttons jump back to relevant section in eal
- * - Bugfix: remove-url-form needs p export
- *
- * Revision 1.40 2002/05/19 11:34:35 jongfoster
- * Handling read-only actions files better - report the actual
- * error, not "Out of memory"!
- *
- * Bug report:
- * http://sourceforge.net/tracker/index.php?func=detail
- * &aid=557905&group_id=11118&atid=111118
- *
- * Revision 1.39 2002/05/12 21:39:15 jongfoster
- * - Adding Doxygen-style comments to structures and #defines.
- * - Correcting function comments
- *
- * Revision 1.38 2002/05/03 23:00:38 jongfoster
- * Support for templates for "standard actions" buttons.
- * See bug #549871
- *
- * Revision 1.37 2002/04/30 11:14:52 oes
- * Made csp the first parameter in *action_to_html
- *
- * Revision 1.36 2002/04/26 21:53:30 jongfoster
- * Fixing a memory leak. (Near, but not caused by, my earlier commit).
- *
- * Revision 1.35 2002/04/26 21:50:02 jongfoster
- * Honouring default exports in edit-actions-for-url-filter template.
- *
- * Revision 1.34 2002/04/26 12:54:17 oes
- * Adaptions to changes in actions.c
- *
- * Revision 1.33 2002/04/24 02:17:47 oes
- * - Moved get_char_param, get_string_param and get_number_param to cgi.c
- * - Comments
- * - Activated Jon's code for editing multiple AFs
- * - cgi_edit_list_actions now provides context-sensitive
- * help, looks up all action sets from standard.action and
- * makes buttons for them in the catchall section
- * - cgi_edit_action_submit now honors a p parameter, looks up
- * the corresponding action set, and sets the catchall pattern's
- * actions accordingly.
- *
- * Revision 1.32 2002/04/19 16:55:31 jongfoster
- * Fixing newline problems. If we do our own text file newline
- * mangling, we don't want the library to do any, so we need to
- * open the files in *binary* mode.
- *
- * Revision 1.31 2002/04/18 19:21:08 jongfoster
- * Added code to detect "conventional" action files, that start
- * with a set of actions for all URLs (the pattern "/").
- * These are special-cased in the "edit-actions-list" CGI, so
- * that a special UI can be written for them.
- *
- * Revision 1.30 2002/04/10 13:38:35 oes
- * load_template signature changed
- *
- * Revision 1.29 2002/04/08 16:59:08 oes
- * Fixed comment
- *
- * Revision 1.28 2002/03/27 12:30:29 oes
- * Deleted unsused variable
- *
- * Revision 1.27 2002/03/26 23:06:04 jongfoster
- * Removing duplicate @ifs on the toggle page
- *
- * Revision 1.26 2002/03/26 22:59:17 jongfoster
- * Fixing /toggle to display status consistently.
- *
- * Revision 1.25 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.24 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.23 2002/03/24 13:32:41 swa
- * name change related issues
- *
- * Revision 1.22 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.21 2002/03/22 18:02:48 jongfoster
- * Fixing remote toggle
- *
- * Revision 1.20 2002/03/16 20:28:34 oes
- * Added descriptions to the filters so users will know what they select in the cgi editor
- *
- * Revision 1.19 2002/03/16 18:38:14 jongfoster
- * Stopping stupid or malicious users from breaking the actions
- * file using the web-based editor.
- *
- * Revision 1.18 2002/03/16 14:57:44 jongfoster
- * Full support for enabling/disabling modular filters.
- *
- * Revision 1.17 2002/03/16 14:26:42 jongfoster
- * First version of modular filters support - READ ONLY!
- * Fixing a double-free bug in the out-of-memory handling in map_radio().
- *
- * Revision 1.16 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.15 2002/03/06 22:54:35 jongfoster
- * Automated function-comment nitpicking.
- *
- * Revision 1.14 2002/03/05 00:24:51 jongfoster
- * Patch to always edit the current actions file.
- *
- * Revision 1.13 2002/03/04 02:07:59 david__schmidt
- * Enable web editing of actions file on OS/2 (it had been broken all this time!)
- *
- * Revision 1.12 2002/03/03 09:18:03 joergs
- * Made jumbjuster work on AmigaOS again.
- *
- * Revision 1.11 2002/01/23 01:03:31 jongfoster
- * Fixing gcc [CygWin] compiler warnings
- *
- * Revision 1.10 2002/01/23 00:22:59 jongfoster
- * Adding new function cgi_edit_actions_section_swap(), to reorder
- * the actions file.
- *
- * Adding get_url_spec_param() to get a validated URL pattern.
- *
- * Moving edit_read_line() out of this file and into loaders.c.
- *
- * Adding missing html_encode() to many CGI functions.
- *
- * Moving the functions that #include actionlist.h to the end of the file,
- * because the Visual C++ 97 debugger gets extremely confused if you try
- * to debug any code that comes after them in the file.
- *
- * Major optimizations in cgi_edit_actions_list() to reduce the size of
- * the generated HTML (down 40% from 550k to 304k), with major side-effects
- * throughout the editor and templates. In particular, the length of the
- * URLs throughout the editor has been drastically reduced, by cutting
- * paramater names down to 1 character and CGI names down to 3-4
- * characters, by removing all non-essential CGI paramaters even at the
- * expense of having to re-read the actions file for the most trivial
- * page, and by using relative rather than absolute URLs. This means
- * that this (typical example):
- *
- * <a href="http://ijbswa.sourceforge.net/config/edit-actions-url-form?
- * filename=ijb&ver=1011487572&section=12&pattern=13
- * &oldval=www.oesterhelt.org%2Fdeanimate-demo">
- *
- * is now this:
- *
- * <a href="eau?f=ijb&v=1011487572&p=13">
- *
- * Revision 1.9 2002/01/17 20:56:22 jongfoster
- * Replacing hard references to the URL of the config interface
- * with #defines from project.h
- *
- * Revision 1.8 2001/11/30 23:35:51 jongfoster
- * Renaming actionsfile to ijb.action
- *
- * Revision 1.7 2001/11/13 00:28:24 jongfoster
- * - Renaming parameters from edit-actions-for-url so that they only
- * contain legal JavaScript characters. If we wanted to write
- * JavaScript that worked with Netscape 4, this is nessacery.
- * (Note that at the moment the JavaScript doesn't actually work
- * with Netscape 4, but now this is purely a template issue, not
- * one affecting code).
- * - Adding new CGIs for use by non-JavaScript browsers:
- * edit-actions-url-form
- * edit-actions-add-url-form
- * edit-actions-remove-url-form
- * - Fixing || bug.
- *
- * Revision 1.6 2001/10/29 03:48:09 david__schmidt
- * OS/2 native needed a snprintf() routine. Added one to miscutil, brackedted
- * by and __OS2__ ifdef.
- *
- * Revision 1.5 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.4 2001/10/23 21:48:19 jongfoster
- * Cleaning up error handling in CGI functions - they now send back
- * a HTML error page and should never cause a FATAL error. (Fixes one
- * potential source of "denial of service" attacks).
- *
- * CGI actions file editor that works and is actually useful.
- *
- * Ability to toggle JunkBuster remotely using a CGI call.
- *
- * You can turn off both the above features in the main configuration
- * file, e.g. if you are running a multi-user proxy.
- *
- * Revision 1.3 2001/10/14 22:12:49 jongfoster
- * New version of CGI-based actionsfile editor.
- * Major changes, including:
- * - Completely new file parser and file output routines
- * - edit-actions CGI renamed edit-actions-for-url
- * - All CGIs now need a filename parameter, except for...
- * - New CGI edit-actions which doesn't need a filename,
- * to allow you to start the editor up.
- * - edit-actions-submit now works, and now automatically
- * redirects you back to the main edit-actions-list handler.
- *
- * Revision 1.2 2001/09/16 17:05:14 jongfoster
- * Removing unused #include showarg.h
- *
- * Revision 1.1 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- *
**********************************************************************/
-\f
+
#include "config.h"
#ifndef CGIEDIT_H_INCLUDED
#define CGIEDIT_H_INCLUDED
-#define CGIEDIT_H_VERSION "$Id: cgiedit.h,v 1.9 2006/07/18 14:48:45 david__schmidt Exp $"
+#define CGIEDIT_H_VERSION "$Id: cgiedit.h,v 1.10 2008/08/31 15:59:03 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: cgiedit.h,v $
- * Revision 1.9 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.7.2.2 2004/02/17 13:30:23 oes
- * Moved cgi_error_disabled() from cgiedit.c to
- * cgi.c to re-enable build with --disable-editor.
- * Fixes Bug #892744. Thanks to Matthew Fischer
- * for spotting.
- *
- * Revision 1.7.2.1 2002/11/28 18:15:17 oes
- * Added cgi_error_disabled
- *
- * Revision 1.7 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.6 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.5 2002/01/22 23:24:48 jongfoster
- * Adding edit-actions-section-swap
- *
- * Revision 1.4 2001/11/13 00:28:51 jongfoster
- * Adding new CGIs for use by non-JavaScript browsers:
- * edit-actions-url-form
- * edit-actions-add-url-form
- * edit-actions-remove-url-form
- *
- * Revision 1.3 2001/10/23 21:48:19 jongfoster
- * Cleaning up error handling in CGI functions - they now send back
- * a HTML error page and should never cause a FATAL error. (Fixes one
- * potential source of "denial of service" attacks).
- *
- * CGI actions file editor that works and is actually useful.
- *
- * Ability to toggle JunkBuster remotely using a CGI call.
- *
- * You can turn off both the above features in the main configuration
- * file, e.g. if you are running a multi-user proxy.
- *
- * Revision 1.2 2001/10/14 22:12:49 jongfoster
- * New version of CGI-based actionsfile editor.
- * Major changes, including:
- * - Completely new file parser and file output routines
- * - edit-actions CGI renamed edit-actions-for-url
- * - All CGIs now need a filename parameter, except for...
- * - New CGI edit-actions which doesn't need a filename,
- * to allow you to start the editor up.
- * - edit-actions-submit now works, and now automatically
- * redirects you back to the main edit-actions-list handler.
- *
- * Revision 1.1 2001/09/16 15:47:37 jongfoster
- * First version of CGI-based edit interface. This is very much a
- * work-in-progress, and you can't actually use it to edit anything
- * yet. You must #define FEATURE_CGI_EDIT_ACTIONS for these changes
- * to have any effect.
- *
- *
**********************************************************************/
-\f
+
#include "project.h"
-const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.91 2009/03/08 14:19:23 fabiankeil Exp $";
+const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.92 2009/04/17 11:47:40 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: cgisimple.c,v $
- * Revision 1.91 2009/03/08 14:19:23 fabiankeil
- * Fix justified (but harmless) compiler warnings
- * on platforms where sizeof(int) < sizeof(long).
- *
- * Revision 1.90 2009/03/01 18:43:09 fabiankeil
- * Fix cparser warnings.
- *
- * Revision 1.89 2008/10/11 11:31:14 fabiankeil
- * Add FEATURE_CONNECTION_KEEP_ALIVE to the list
- * of conditional defines on the show-status page.
- *
- * Revision 1.88 2008/08/30 12:03:07 fabiankeil
- * Remove FEATURE_COOKIE_JAR.
- *
- * Revision 1.87 2008/08/29 15:59:22 fabiankeil
- * Fix two comments.
- *
- * Revision 1.86 2008/06/28 14:19:05 fabiankeil
- * Protocol detection is done case-insensitive, fix assertion
- * to do the same. Yay for Privoxy-Regression-Test and zzuf.
- *
- * Revision 1.85 2008/05/26 17:30:55 fabiankeil
- * Provide an OpenSearch Description to access the
- * show-url-info page through "search engine plugins".
- *
- * Revision 1.84 2008/05/26 16:16:55 fabiankeil
- * Spell error correctly.
- *
- * Revision 1.83 2008/05/12 14:51:30 fabiankeil
- * Don't complain about an invalid URL if show-url-info is requested
- * without parameters. Regression introduced in 1.81 by yours truly.
- *
- * Revision 1.82 2008/05/10 20:01:47 fabiankeil
- * Fix an assertion that could erroneously
- * trigger in case of memory shortage.
- *
- * Revision 1.81 2008/05/05 09:54:39 fabiankeil
- * In cgi_show_url_info(), make sure ftp URLs are
- * declared invalid. Also simplify the code that adds
- * "http://" if no protocol has been specified.
- *
- * Revision 1.80 2008/05/04 16:18:32 fabiankeil
- * Provide parse_http_url() with a third parameter to specify
- * whether or not URLs without protocol are acceptable.
- *
- * Revision 1.79 2008/05/04 13:30:56 fabiankeil
- * Streamline parse_http_url()'s prototype.
- *
- * Revision 1.78 2008/05/03 16:50:11 fabiankeil
- * Leverage content_filters_enabled() in cgi_show_url_info().
- *
- * Revision 1.77 2008/05/02 09:47:48 fabiankeil
- * In cgi_show_url_info, pass an initialized http structure
- * to parse_http_url() as that will be required soonish and
- * assert that https URLs are recognized correctly.
- *
- * Revision 1.76 2008/04/28 09:13:30 fabiankeil
- * In load_file(), remember the error reason and fclose()
- * and return later on instead of right away.
- *
- * Revision 1.75 2008/04/27 13:52:52 fabiankeil
- * Move CGI file loading code into load_file() and
- * add checks for unexpected errors.
- *
- * Revision 1.74 2008/04/26 15:50:56 fabiankeil
- * Fix macro name in cgi_show_file() error path.
- *
- * Revision 1.73 2008/04/26 12:21:55 fabiankeil
- * Forget about JB_ERR_PARSE. JB_ERR_CGI_PARAMS to the rescue.
- *
- * Revision 1.72 2008/04/26 10:34:15 fabiankeil
- * If zlib support is unavailable and there are content filters active
- * but the prevent-compression action is disabled, include a warning
- * on the show-url-info page that compression might prevent filtering.
- *
- * Revision 1.71 2008/04/25 13:33:56 fabiankeil
- * - Factor cgi_show_file() out of cgi_show_status().
- * - Adjust cgi_show_status()'s parameter description to match reality.
- *
- * Revision 1.70 2008/04/24 16:12:38 fabiankeil
- * In cgi_show_status(), load the requested file at once.
- * Using string_join() for every line really doesn't scale.
- *
- * Revision 1.69 2008/04/17 14:40:48 fabiankeil
- * Provide get_http_time() with the buffer size so it doesn't
- * have to blindly assume that the buffer is big enough.
- *
- * Revision 1.68 2008/03/27 18:27:21 fabiankeil
- * Remove kill-popups action.
- *
- * Revision 1.67 2008/03/27 17:00:05 fabiankeil
- * Turn the favicon blobs into locals.
- *
- * Revision 1.66 2008/02/23 16:57:12 fabiankeil
- * Rename url_actions() to get_url_actions() and let it
- * use the standard parameter ordering.
- *
- * Revision 1.65 2008/02/23 16:33:43 fabiankeil
- * Let forward_url() use the standard parameter ordering
- * and mark its second parameter immutable.
- *
- * Revision 1.64 2008/02/03 13:56:07 fabiankeil
- * Add SOCKS5 support for show-url-info CGI page.
- *
- * Revision 1.63 2008/02/01 06:04:31 fabiankeil
- * If edit buttons on the show-url-info CGI page are hidden, explain why.
- *
- * Revision 1.62 2008/02/01 05:52:40 fabiankeil
- * Hide edit buttons on the show-url-info CGI page if enable-edit-action
- * is disabled. Patch by Lee with additional white space adjustments.
- *
- * Revision 1.61 2008/01/26 11:13:25 fabiankeil
- * If enable-edit-actions is disabled, hide the edit buttons and explain why.
- *
- * Revision 1.60 2007/10/27 13:12:13 fabiankeil
- * Finish 1.49 and check write access before
- * showing edit buttons on show-url-info page.
- *
- * Revision 1.59 2007/10/19 16:42:36 fabiankeil
- * Plug memory leak I introduced five months ago.
- * Yay Valgrind and Privoxy-Regression-Test.
- *
- * Revision 1.58 2007/07/21 12:19:50 fabiankeil
- * If show-url-info is called with an URL that Privoxy
- * would reject as invalid, don't show unresolved forwarding
- * variables, "final matches" or claim the site's secure.
- *
- * Revision 1.57 2007/06/01 16:53:05 fabiankeil
- * Adjust cgi_show_url_info() to show what forward-override{}
- * would do with the requested URL (instead of showing how the
- * request for the CGI page would be forwarded if it wasn't a
- * CGI request).
- *
- * Revision 1.56 2007/05/21 10:50:35 fabiankeil
- * - Use strlcpy() instead of strcpy().
- * - Stop treating actions files special. Expect a complete file name
- * (with or without path) like it's done for the rest of the files.
- * Closes FR#588084.
- * - Don't rerun sed() in cgi_show_request().
- *
- * Revision 1.55 2007/04/13 13:36:46 fabiankeil
- * Reference action files in CGI URLs by id instead
- * of using the first part of the file name.
- * Fixes BR 1694250 and BR 1590556.
- *
- * Revision 1.54 2007/04/09 18:11:35 fabiankeil
- * Don't mistake VC++'s _snprintf() for a snprintf() replacement.
- *
- * Revision 1.53 2007/04/08 13:21:04 fabiankeil
- * Reference action files in CGI URLs by id instead
- * of using the first part of the file name.
- * Fixes BR 1694250 and BR 1590556.
- *
- * Revision 1.52 2007/02/13 15:10:26 fabiankeil
- * Apparently fopen()ing in "binary" mode doesn't require
- * #ifdefs, it's already done without them in cgiedit.c.
- *
- * Revision 1.51 2007/02/10 16:55:22 fabiankeil
- * - Show forwarding settings on the show-url-info page
- * - Fix some HTML syntax errors.
- *
- * Revision 1.50 2007/01/23 15:51:17 fabiankeil
- * Add favicon delivery functions.
- *
- * Revision 1.49 2007/01/20 16:29:38 fabiankeil
- * Suppress edit buttons for action files if Privoxy has
- * no write access. Suggested by Roland in PR 1564026.
- *
- * Revision 1.48 2007/01/20 15:31:31 fabiankeil
- * Display warning if show-url-info CGI page
- * is used while Privoxy is toggled off.
- *
- * Revision 1.47 2007/01/12 15:07:10 fabiankeil
- * Use zalloc in cgi_send_user_manual.
- *
- * Revision 1.46 2007/01/02 12:49:46 fabiankeil
- * Add FEATURE_ZLIB to the list of conditional
- * defines at the show-status page.
- *
- * Revision 1.45 2006/12/28 18:16:41 fabiankeil
- * Fixed gcc43 compiler warnings, zero out cgi_send_user_manual's
- * body memory before using it, replaced sprintf calls with snprintf.
- *
- * Revision 1.44 2006/12/22 14:19:27 fabiankeil
- * Removed checks whether or not AF_FILES have
- * data structures associated with them in cgi_show_status.
- * It doesn't matter as we're only interested in the file names.
- *
- * For the action files the checks were always true,
- * but they prevented empty filter files from being
- * listed. Fixes parts of BR 1619208.
- *
- * Revision 1.43 2006/12/17 17:57:56 fabiankeil
- * - Added FEATURE_GRACEFUL_TERMINATION to the
- * "conditional #defines" section
- * - Escaped ampersands in generated HTML.
- * - Renamed re-filter-filename to re-filter-filenames
- *
- * Revision 1.42 2006/11/21 15:43:12 fabiankeil
- * Add special treatment for WIN32 to make sure
- * cgi_send_user_manual opens the files in binary mode.
- * Fixes BR 1600411 and unbreaks image delivery.
- *
- * Remove outdated comment.
- *
- * Revision 1.41 2006/10/09 19:18:28 roro
- * Redirect http://p.p/user-manual (without trailing slash) to
- * http://p.p/user-manual/ (with trailing slash), otherwise links will be broken.
- *
- * Revision 1.40 2006/09/09 13:05:33 fabiankeil
- * Modified cgi_send_user_manual to serve binary
- * content without destroying it first. Should also be
- * faster now. Added ".jpg" check for Content-Type guessing.
- *
- * Revision 1.39 2006/09/08 09:49:23 fabiankeil
- * Deliver documents in the user-manual directory
- * with "Content-Type text/css" if their filename
- * ends with ".css".
- *
- * Revision 1.38 2006/09/06 18:45:03 fabiankeil
- * Incorporate modified version of Roland Rosenfeld's patch to
- * optionally access the user-manual via Privoxy. Closes patch 679075.
- *
- * Formatting changed to Privoxy style, added call to
- * cgi_error_no_template if the requested file doesn't
- * exist and modified check whether or not Privoxy itself
- * should serve the manual. Should work cross-platform now.
- *
- * Revision 1.37 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.35.2.7 2006/01/29 23:10:56 david__schmidt
- * Multiple filter file support
- *
- * Revision 1.35.2.6 2005/07/04 03:13:43 david__schmidt
- * Undo some damaging memory leak patches
- *
- * Revision 1.35.2.5 2005/05/07 21:50:55 david__schmidt
- * A few memory leaks plugged (mostly on error paths)
- *
- * Revision 1.35.2.4 2005/04/04 02:21:24 david__schmidt
- * Another instance of:
- * Don't show "Edit" buttons #ifndef FEATURE_CGI_EDIT_ACTIONS
- * Thanks to Magnus Holmgren for the patch
- *
- * Revision 1.35.2.3 2003/12/17 16:34:15 oes
- * - Prevent line wrap beween "View/Edit" link buttons on status page
- * - Some (mostly irrelevant) fixes for Out-of-mem-case handling
- *
- * Revision 1.35.2.2 2003/04/03 13:48:28 oes
- * Don't show "Edit" buttons #ifndef FEATURE_CGI_EDIT_ACTIONS
- *
- * Revision 1.35.2.1 2002/07/04 15:02:38 oes
- * Added ability to send redirects to send-banner CGI, so that it can completely mimic the image blocking action if called with type=auto
- *
- * Revision 1.35.2.1 2002/07/01 17:32:04 morcego
- * Applying patch from Andreas as provided by Hal on the list.
- * Message-ID: <20020701121218.V1606@feenix.burgiss.net>
- *
- * Revision 1.35 2002/05/12 21:44:44 jongfoster
- * Adding amiga.[ch] revision information, if on an amiga.
- *
- * Revision 1.34 2002/04/30 12:06:12 oes
- * Deleted unused code from default_cgi
- *
- * Revision 1.33 2002/04/30 11:14:52 oes
- * Made csp the first parameter in *action_to_html
- *
- * Revision 1.32 2002/04/26 18:29:13 jongfoster
- * Fixing this Visual C++ warning:
- * cgisimple.c(775) : warning C4018: '<' : signed/unsigned mismatch
- *
- * Revision 1.31 2002/04/26 12:54:36 oes
- * - Kill obsolete REDIRECT_URL code
- * - Error handling fixes
- * - Style sheet related HTML snipplet changes
- * - cgi_show_url_info:
- * - Matches now in table, actions on single lines,
- * linked to help
- * - standard.action suppressed
- * - Buttons to View and Edit AFs
- *
- * Revision 1.30 2002/04/24 02:18:08 oes
- * - show-status is now the starting point for editing
- * the actions files, generate list of all AFs with buttons
- * for viewing and editing, new look for file list (Jon:
- * buttons now aligned ;-P ), view mode now supports multiple
- * AFs, name changes, no view links for unspecified files,
- * no edit link for standard.action.
- *
- * - Jon's multiple AF patch: cgi_show_url_info now uses all
- * AFs and marks the output accordingly
- *
- * Revision 1.29 2002/04/10 13:38:35 oes
- * load_template signature changed
- *
- * Revision 1.28 2002/04/07 15:42:12 jongfoster
- * Fixing send-banner?type=auto when the image-blocker is
- * a redirect to send-banner
- *
- * Revision 1.27 2002/04/05 15:50:48 oes
- * added send-stylesheet CGI
- *
- * Revision 1.26 2002/04/04 00:36:36 gliptak
- * always use pcre for matching
- *
- * Revision 1.25 2002/04/03 22:28:03 gliptak
- * Removed references to gnu_regex
- *
- * Revision 1.24 2002/04/02 16:12:47 oes
- * Fix: moving misplaced lines into #ifdef FEATURE_FORCE
- *
- * Revision 1.23 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.22 2002/03/24 16:18:15 jongfoster
- * Removing old logo
- *
- * Revision 1.21 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.20 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.19 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.18 2002/03/12 01:44:49 oes
- * Changed default for "blocked" image from jb logo to checkboard pattern
- *
- * Revision 1.17 2002/03/08 16:43:18 oes
- * Added choice beween GIF and PNG built-in images
- *
- * Revision 1.16 2002/03/07 03:48:38 oes
- * - Changed built-in images from GIF to PNG
- * (with regard to Unisys patent issue)
- * - Added a 4x4 pattern PNG which is less intrusive
- * than the logo but also clearly marks the deleted banners
- *
- * Revision 1.15 2002/03/06 22:54:35 jongfoster
- * Automated function-comment nitpicking.
- *
- * Revision 1.14 2002/03/02 04:14:50 david__schmidt
- * Clean up a little CRLF unpleasantness that suddenly appeared
- *
- * Revision 1.13 2002/02/21 00:10:37 jongfoster
- * Adding send-banner?type=auto option
- *
- * Revision 1.12 2002/01/23 01:03:32 jongfoster
- * Fixing gcc [CygWin] compiler warnings
- *
- * Revision 1.11 2002/01/23 00:01:04 jongfoster
- * Adding cgi_transparent_gif() for http://i.j.b/t
- * Adding missing html_encode() to many CGI functions.
- * Adding urlmatch.[ch] to http://i.j.b/show-version
- *
- * Revision 1.10 2002/01/17 21:10:37 jongfoster
- * Changes to cgi_show_url_info to use new matching code from urlmatch.c.
- * Also fixing a problem in the same function with improperly quoted URLs
- * in output HTML, and adding code to handle https:// URLs correctly.
- *
- * Revision 1.9 2001/11/30 23:09:15 jongfoster
- * Now reports on FEATURE_CGI_EDIT_ACTIONS
- * Removing FEATURE_DENY_GZIP from template
- *
- * Revision 1.8 2001/11/13 00:14:07 jongfoster
- * Fixing stupid bug now I've figured out what || means.
- * (It always returns 0 or 1, not one of it's paramaters.)
- *
- * Revision 1.7 2001/10/23 21:48:19 jongfoster
- * Cleaning up error handling in CGI functions - they now send back
- * a HTML error page and should never cause a FATAL error. (Fixes one
- * potential source of "denial of service" attacks).
- *
- * CGI actions file editor that works and is actually useful.
- *
- * Ability to toggle JunkBuster remotely using a CGI call.
- *
- * You can turn off both the above features in the main configuration
- * file, e.g. if you are running a multi-user proxy.
- *
- * Revision 1.6 2001/10/14 22:00:32 jongfoster
- * Adding support for a 404 error when an invalid CGI page is requested.
- *
- * Revision 1.5 2001/10/07 15:30:41 oes
- * Removed FEATURE_DENY_GZIP
- *
- * Revision 1.4 2001/10/02 15:31:12 oes
- * Introduced show-request cgi
- *
- * Revision 1.3 2001/09/22 16:34:44 jongfoster
- * Removing unneeded #includes
- *
- * Revision 1.2 2001/09/19 18:01:11 oes
- * Fixed comments; cosmetics
- *
- * Revision 1.1 2001/09/16 17:08:54 jongfoster
- * Moving simple CGI functions from cgi.c to new file cgisimple.c
- *
- *
**********************************************************************/
-\f
+
#include "config.h"
#ifndef CGISIMPLE_H_INCLUDED
#define CGISIMPLE_H_INCLUDED
-#define CGISIMPLE_H_VERSION "$Id: cgisimple.h,v 1.15 2007/01/23 15:51:17 fabiankeil Exp $"
+#define CGISIMPLE_H_VERSION "$Id: cgisimple.h,v 1.16 2008/05/26 17:30:55 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgisimple.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: cgisimple.h,v $
- * Revision 1.15 2007/01/23 15:51:17 fabiankeil
- * Add favicon delivery functions.
- *
- * Revision 1.14 2006/09/06 18:45:03 fabiankeil
- * Incorporate modified version of Roland Rosenfeld's patch to
- * optionally access the user-manual via Privoxy. Closes patch 679075.
- *
- * Formatting changed to Privoxy style, added call to
- * cgi_error_no_template if the requested file doesn't
- * exist and modified check whether or not Privoxy itself
- * should serve the manual. Should work cross-platform now.
- *
- * Revision 1.13 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.11 2002/04/05 15:50:53 oes
- * added send-stylesheet CGI
- *
- * Revision 1.10 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.9 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.8 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.7 2002/03/08 16:43:59 oes
- * Renamed cgi_transparent_png to cgi_transparent_image
- *
- * Revision 1.6 2002/03/07 03:48:59 oes
- * - Changed built-in images from GIF to PNG
- * (with regard to Unisys patent issue)
- *
- * Revision 1.5 2002/01/22 23:26:03 jongfoster
- * Adding cgi_transparent_gif() for http://i.j.b/t
- *
- * Revision 1.4 2001/10/23 21:48:19 jongfoster
- * Cleaning up error handling in CGI functions - they now send back
- * a HTML error page and should never cause a FATAL error. (Fixes one
- * potential source of "denial of service" attacks).
- *
- * CGI actions file editor that works and is actually useful.
- *
- * Ability to toggle JunkBuster remotely using a CGI call.
- *
- * You can turn off both the above features in the main configuration
- * file, e.g. if you are running a multi-user proxy.
- *
- * Revision 1.3 2001/10/14 22:00:32 jongfoster
- * Adding support for a 404 error when an invalid CGI page is requested.
- *
- * Revision 1.2 2001/10/02 15:31:20 oes
- * Introduced show-request cgi
- *
- * Revision 1.1 2001/09/16 17:08:54 jongfoster
- * Moving simple CGI functions from cgi.c to new file cgisimple.c
- *
- *
**********************************************************************/
-\f
+
#include "project.h"
#ifndef CYGWIN_H_INCLUDED
#define CYGWIN_H_INCLUDED
-#define CYGWIN_H_VERSION "$Id: cygwin.h,v 1.4 2002/03/26 22:29:54 swa Exp $"
+#define CYGWIN_H_VERSION "$Id: cygwin.h,v 1.6 2006/07/18 14:48:45 david__schmidt Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/Attic/cygwin.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/cygwin.h,v $
*
* Purpose : The windows.h file seems to be a *tad* different, so I
* will bridge the gaps here. Perhaps I should convert the
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: cygwin.h,v $
- * Revision 1.4 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.3 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.2 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.1.1.1 2001/05/15 13:58:51 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
/* Conditionally include this whole file. */
-const char deanimate_rcs[] = "$Id: deanimate.c,v 1.18 2008/03/28 15:13:38 fabiankeil Exp $";
+const char deanimate_rcs[] = "$Id: deanimate.c,v 1.19 2008/05/21 15:29:35 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/deanimate.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: deanimate.c,v $
- * Revision 1.18 2008/03/28 15:13:38 fabiankeil
- * Remove inspect-jpegs action.
- *
- * Revision 1.17 2007/08/05 13:42:22 fabiankeil
- * #1763173 from Stefan Huehner: declare some more functions static.
- *
- * Revision 1.16 2007/07/14 08:01:58 fabiankeil
- * s@failiure@failure@
- *
- * Revision 1.15 2007/01/03 14:39:19 fabiankeil
- * Fix a gcc43 warning and mark the binbuffer
- * as immutable for buf_getbyte().
- *
- * Revision 1.14 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.12.2.1 2004/10/03 12:53:32 david__schmidt
- * Add the ability to check jpeg images for invalid
- * lengths of comment blocks. Defensive strategy
- * against the exploit:
- * Microsoft Security Bulletin MS04-028
- * Buffer Overrun in JPEG Processing (GDI+) Could
- * Allow Code Execution (833987)
- * Enabled with +inspect-jpegs in actions files.
- *
- * Revision 1.12 2002/05/12 21:36:29 jongfoster
- * Correcting function comments
- *
- * Revision 1.11 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.10 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.9 2002/03/13 00:27:04 jongfoster
- * Killing warnings
- *
- * Revision 1.8 2002/03/09 19:42:47 jongfoster
- * Fixing more warnings
- *
- * Revision 1.7 2002/03/08 17:46:04 jongfoster
- * Fixing int/size_t warnings
- *
- * Revision 1.6 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.5 2001/09/10 10:16:06 oes
- * Silenced compiler warnings
- *
- * Revision 1.4 2001/07/18 12:28:49 oes
- * - Added feature for extracting the first frame
- * to gif_deanimate
- * - Separated image buffer extension into buf_extend
- * - Extended gif deanimation to GIF87a (untested!)
- * - Cosmetics
- *
- * Revision 1.3 2001/07/15 13:57:50 jongfoster
- * Adding #includes string.h and miscutil.h
- *
- * Revision 1.2 2001/07/13 13:46:20 oes
- * Introduced GIF deanimation feature
- *
- *
**********************************************************************/
-\f
+
#include "config.h"
#ifndef DEANIMATE_H_INCLUDED
#define DEANIMATE_H_INCLUDED
-#define DEANIMATE_H_VERSION "$Id: deanimate.h,v 1.11 2007/01/12 15:41:00 fabiankeil Exp $"
+#define DEANIMATE_H_VERSION "$Id: deanimate.h,v 1.12 2008/03/28 15:13:39 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/deanimate.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: deanimate.h,v $
- * Revision 1.11 2007/01/12 15:41:00 fabiankeil
- * Remove some white space at EOL.
- *
- * Revision 1.10 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.8.2.1 2004/10/03 12:53:32 david__schmidt
- * Add the ability to check jpeg images for invalid
- * lengths of comment blocks. Defensive strategy
- * against the exploit:
- * Microsoft Security Bulletin MS04-028
- * Buffer Overrun in JPEG Processing (GDI+) Could
- * Allow Code Execution (833987)
- * Enabled with +inspect-jpegs in actions files.
- *
- * Revision 1.8 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.7 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.6 2002/03/08 17:46:04 jongfoster
- * Fixing int/size_t warnings
- *
- * Revision 1.5 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.4 2001/07/29 18:50:04 jongfoster
- * Fixing "extern C" block, and renaming #define _DEANIMATE_H
- *
- * Revision 1.3 2001/07/18 12:29:05 oes
- * Updated prototype for gif_deanimate
- *
- * Revision 1.2 2001/07/13 13:46:20 oes
- * Introduced GIF deanimation feature
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
#
# File : $Source: /cvsroot/ijbswa/current/default.filter,v $
#
-# $Id: default.filter,v 1.70 2009/02/21 13:01:51 fabiankeil Exp $
+# $Id: default.filter,v 1.71 2009/03/01 18:33:17 ler762 Exp $
#
# Purpose : Rules to process the content of web pages
#
SERVER-HEADER-FILTER: privoxy-control Removes X-Privoxy-Control headers.
s@^X-Privoxy-Control:.*@@i
-
-
-##############################################################################
-#
-# Revisions :
-# $Log: default.filter,v $
-# Revision 1.70 2009/02/21 13:01:51 fabiankeil
-# Make blogspot's feed magic slightly more reliable.
-#
-# Revision 1.69 2009/02/12 15:40:11 ler762
-# more yahoo email ad blocking
-#
-# Revision 1.68 2008/09/19 13:26:04 fabiankeil
-# s@tounge@tongue@. Anonymously reported in #1648657.
-#
-# Revision 1.67 2008/08/06 17:38:06 fabiankeil
-# In banners-by-size, make sure white-space around the height
-# attribute is removed as well and replace two spaces with
-# "\s" so we don't get fooled by tabs. Fixes #2036125.
-#
-# Revision 1.66 2008/08/03 17:27:47 fabiankeil
-# Teach msn filter to catch a few new ad classes.
-#
-# Revision 1.65 2008/07/21 13:43:44 fabiankeil
-# Fix img-reorder regression introduced with my last commit.
-# Some tags were terminated too soon, letting the browser render
-# some of their arguments as text. Oops.
-#
-# Revision 1.64 2008/07/12 15:49:09 fabiankeil
-# - Don't let img-reorder touch width attributes
-# that aren't followed by either whitespace or '>',
-# as those usually indicate onclick nonsense.
-# Problem and solution reported by Glenn Washburn in #2014552.
-# - While at it, don't use more groups than necessary.
-#
-# Revision 1.63 2008/06/27 12:53:41 fabiankeil
-# Make sure the taggers css-requests and image-requests
-# only match at the beginning of the header.
-#
-# Revision 1.62 2008/06/21 17:02:03 fabiankeil
-# Fix typo.
-#
-# Revision 1.61 2008/05/21 18:44:43 fabiankeil
-# - Let the content-type tagger ignore headers without value.
-# - Remove a few unused lines at the end of the file.
-#
-# Revision 1.60 2008/04/26 10:36:41 fabiankeil
-# Let the msn filter hide another class.
-#
-# Revision 1.59 2008/04/23 16:18:18 fabiankeil
-# s@declarded@declared@
-#
-# Revision 1.58 2008/02/02 15:27:19 fabiankeil
-# Yet another yahoo update to get the width limitation removal working again.
-#
-# Revision 1.57 2008/01/26 15:45:39 fabiankeil
-# Don't let the less-download-windows filter mess up
-# "Content-Type: application/x-shockwave-flash" headers.
-#
-# Revision 1.56 2008/01/25 19:12:40 fabiankeil
-# - Add yet another new yahoo ad id.
-# - Don't let the first banners-by-link job punish URLs for merely
-# containing the pattern "/jump/" when it should really look for
-# "doubleclick\.net/jump/".
-#
-# Revision 1.55 2007/12/31 19:53:59 fabiankeil
-# Let the msn filter remove the width limitation again.
-#
-# Revision 1.54 2007/12/31 19:11:31 fabiankeil
-# - Let the yahoo filter remove the width limitation again.
-# - Teach the blogspot filter to remove useless feed comment
-# titles that only contain the beginning of the actual comment.
-#
-# Revision 1.53 2007/12/23 15:48:12 fabiankeil
-# - Lo and behold, the CSS fix for the MSN buttons is no longer necessary.
-# - Add some new selectors the msn filter should hide.
-# - Add the two yahoo selectors Lee reported in #1856574.
-# - Add comments that the width limitation fixes stopped
-# working for the msn and yahoo filter.
-#
-# Revision 1.52 2007/11/27 18:35:48 fabiankeil
-# Update CSS for the yahoo filter.
-#
-# Revision 1.51 2007/11/04 16:15:11 fabiankeil
-# - Add client-header taggers: client-ip-address,
-# http-method, allow-post, complete-url and user-agent.
-# - Add server-header tagger: content-type.
-#
-# Revision 1.50 2007/11/03 15:05:30 fabiankeil
-# Consistently use an empty line between the description and the PCRS code
-# and end descriptions with dots. Patch submitted by Simon Ruderich.
-#
-# Revision 1.49 2007/11/03 14:29:41 fabiankeil
-# Spelling fixes mostly submitted by Simon Ruderich.
-#
-# Revision 1.48 2007/10/17 18:11:32 fabiankeil
-# Add privoxy-control header filters and taggers.
-#
-# Revision 1.47 2007/10/06 15:45:25 fabiankeil
-# Let msn hide sponsored links in #at divs.
-#
-# Revision 1.46 2007/10/06 09:54:13 fabiankeil
-# - Let msn hide sponsored links in #ar divs.
-# - Teach banners-by-link not to block the graphs for sf's tracker statistics.
-#
-# Revision 1.45 2007/08/11 16:54:12 fabiankeil
-# - Complete the changes from r1.42.
-# - Make crude-parental less sensitive to the amount of white-space,
-# add the note that it doesn't work too well again and replace the
-# DMOZ link with a less confusing explanation.
-#
-# Revision 1.44 2007/07/18 11:06:56 hal9
-# Replace notarget with '' in all popups filter to keep from breaking xhmtl per
-# report from Siegfried Gipp.
-#
-# Revision 1.43 2007/06/01 14:17:04 fabiankeil
-# Mention possible delimiter conflicts with variables in dynamic pcrs commands.
-#
-# Revision 1.42 2007/05/17 15:55:36 fabiankeil
-# Undo an improperly tested last-minute change
-# and turn "text-requests" back into "css-requests".
-#
-# Revision 1.41 2007/05/17 15:45:41 fabiankeil
-# - Mention new filter types and the 'D' option.
-# - Header filters are now case-insensitive and accept a
-# varying amount of whitespace after the colon.
-# - Add another selector for yahoo ads.
-# - New server-header filter: less-download-windows
-# - New client-header taggers: text-requests and image-requests.
-#
-# Revision 1.40 2007/03/20 15:40:00 fabiankeil
-# Adjust to new world order with dedicated header-filter actions.
-#
-# Revision 1.39 2007/02/21 14:10:23 fabiankeil
-# - Fix a js-annoyances pcrs command that broke
-# evaluated code. (BR #1124071, thanks to Bor Gergely)
-# - Have unsolicited-popups and all-popups catch the
-# wheather.com popup reported in in AF #1640173.
-#
-# Revision 1.38 2007/02/19 11:22:48 hal9
-# Adding back the orginal filter content to offset problems found by Fabian.
-#
-# Revision 1.37 2007/02/17 13:29:44 hal9
-# Updates to the crude parental filter per Feature Requests item #1648657.
-#
-# Revision 1.36 2007/02/05 16:47:31 fabiankeil
-# - Let banners-by-link look for "advert".
-# - Fix XML systax problems with banners-by-link
-# and banners-by-size (AF#1651570).
-#
-# Revision 1.35 2006/12/21 12:28:12 fabiankeil
-# Escaping special characters in filter descriptions is no
-# longer necessary, it's done by Privoxy now.
-#
-# Revision 1.34 2006/12/12 17:32:23 fabiankeil
-# Added id mbEnd to google filter, it's now and then
-# used for the sponsored links.
-#
-# Have js-annoyances try to prevent status bar
-# modifications where the status bar text is
-# inside another variable. Fixes 1605710.
-#
-# Revision 1.33 2006/11/16 17:10:43 fabiankeil
-# Removed webbugs debugging comment again.
-# The apostrophe could break JavaScript and
-# the comment itself could mess up existing
-# comments.
-#
-# Revision 1.32 2006/11/10 18:04:04 fabiankeil
-# Have no-ping print the ping warning in red.
-#
-# Modified yahoo to keep in sync with recent
-# CSS changes and to suppress a useless horizontal
-# scrollbar.
-#
-# msn now makes sure that the continue-link boxes
-# act as links (the original CSS just changes the cursor).
-#
-# Changed fun filter regex to leave microsoft links alone.
-# Fixes BR 1019996.
-#
-# Revision 1.31 2006/10/21 13:12:28 fabiankeil
-# Added no-ping and hide-tor-exit-notation.
-#
-# Adjusted jumping-windows to break less.
-# Fixes BR 1146134.
-#
-# Revision 1.30 2006/10/18 12:36:50 fabiankeil
-# google filter now cleans Google groups as well.
-#
-# Revision 1.29 2006/10/11 14:03:17 fabiankeil
-# Changed img-reorder regex to only move width
-# attributes if they are following at least one
-# whitespace. Fixes BR 1328455.
-#
-# Revision 1.28 2006/10/11 13:31:13 fabiankeil
-# Added Anduin Withers' js-annoyances fix
-# for not messing up escaped quotes. Fixes BR 999765.
-#
-# Improved blogspot filter to make it less likely that
-# the blogspot banner at the top of the page is missed.
-#
-# Revision 1.27 2006/10/08 17:00:51 fabiankeil
-# Modified webbugs filter to create a comment around the offending
-# image instead of removing it entirely.
-#
-# Adjusted regex to only match if there's at least one whitespace
-# before the width and height attributes. Makes it more likely that
-# they are indeed attributes, and not part of the value of another attribute.
-# Solves BR 1035587.
-#
-# Thanks to Martin Thomas for diagnosing the cause of the problem.
-#
-# Revision 1.26 2006/10/06 18:06:16 fabiankeil
-# Added header filter x-httpd-php-to-html
-# and reverted another img-reorder whitespace
-# problem.
-#
-# Revision 1.25 2006/10/06 15:26:09 fabiankeil
-# Bumped copyright year.
-#
-# Reverted parts of the last img-reorder change
-# which were intended to remove superfluous whitespace
-# but had the side effect to mess up some tags.
-#
-# Modified banners-by-size and banners-by-link to
-# use border value "0" instead of "\0". Fixes BR 1100065.
-#
-# Revision 1.24 2006/10/06 11:25:31 fabiankeil
-# Taught img-reorder not to break img tags
-# with empty src attributes. Fixes BR 1089474.
-# Thanks to Raphael Moll for reporting.
-#
-# Revision 1.23 2006/10/05 14:46:28 fabiankeil
-# Replaced "<" in img-reorder's description with "<".
-#
-# Modified msn filter to tag ads with classes instead
-# of ids. There may be more than one ad per page,
-# but ids are required to be unique.
-#
-# Revision 1.22 2006/10/04 19:17:14 fabiankeil
-# Incorportated Frédéric Crozat's ie-exploits
-# modification to make it less trigger-happy.
-#
-# Modified blogspot filter to make .post-body
-# scrollable if necessary.
-#
-# Revision 1.21 2006/10/02 16:21:14 fabiankeil
-# Adjusted yahoo filter to hide .yschspns as well.
-# Added header filters: html-to-xml and xml-to-html.
-#
-# Revision 1.20 2006/10/01 21:00:22 fabiankeil
-# New site-specific filters: google, yahoo, msn and blogspot.
-#
-# Revision 1.19 2006/07/18 14:48:45 david__schmidt
-# Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
-# with what was really the latest development (the v_3_0_branch branch)
-#
-# Revision 1.11.2.23 2004/02/17 13:34:01 oes
-# - Beefed up the protection of the unsolicited-popups
-# filter against matching in JavaScript string constants.
-# - Extended the fun filter with a German joke
-# - Extended the site-specifics filter with a convenience
-# reeplacement for managing mailing lists at SourceForge
-#
-# Revision 1.11.2.22 2004/01/30 15:29:29 oes
-# Updated the copyright note
-#
-# Revision 1.11.2.21 2004/01/20 15:15:01 oes
-# Detail enhancement in all-popups
-#
-# Revision 1.11.2.20 2004/01/06 16:46:14 oes
-# Fixed a JS syntax problem in jumping-windows
-#
-# Revision 1.11.2.19 2003/12/17 17:09:25 oes
-# Added remedy against IE address bar spoofing
-#
-# Revision 1.11.2.18 2003/12/02 11:25:27 oes
-# Fixed a line trashed in previous commit
-#
-# Revision 1.11.2.17 2003/12/01 21:58:46 oes
-# Assorted tuning:
-#
-# - unsolicited-popups no longer matches at start or end of quoted
-# strings, and is now activated earlier and deactivated later in
-# the page.
-# - replacement images in banners-by-* now without border
-# - more effective shockwave flash flattening
-# - Custom annoyance filtering for Yahoo Groups, Monster.com, NY Times.
-#
-# Revision 1.11.2.16 2003/05/08 09:44:56 oes
-# Allow extra parameters in blink,marquee tags. Fixes bug #734012
-#
-# Revision 1.11.2.15 2003/03/30 13:57:08 oes
-# Making unsolicited-popups safe for use on <html> tags enclosed in JS strings
-#
-# Revision 1.11.2.14 2003/03/19 13:17:50 oes
-# - Added filter "site-specifics" to address site specific problems
-# - Fixed a small problem in the img-reorder filter
-#
-# Revision 1.11.2.13 2003/03/18 19:28:59 oes
-# Fixed a minor problem in the img-reorder filter
-#
-# Revision 1.11.2.12 2003/03/15 14:06:58 oes
-# - Assorted refinements, optimizations and fixes in the js-annoyances,
-# img-reorder, banners-by-size, banners-by-link, webbugs, refresh-tags,
-# html-annoyances, content-cookies and fun filters
-# - Replaced filter "popups" by choice between two modes:
-# - "unsolicited-popups" tries to catch only the unsolicited ones
-# - "all-popups" tries to kill them all (as before)
-# - New filter "tiny-textforms" Help those tiny or hard-wrap textareas.
-# - New filter "jumping-windows" that prevents windows from resizing
-# and moving themselves
-# - Replaced "nimda" with more general "ie-exploits" filter in which
-# all filters for exploits shall be collected
-#
-# Revision 1.11.2.11 2002/11/12 16:14:43 oes
-# Exchanged js-annoyance filter against status bar rewrites with improved version by Don Libes
-#
-# Revision 1.11.2.10 2002/11/11 13:39:47 oes
-# Make refresh-tags filter work even on incorrect refresh tags like found on usatoday.com
-#
-# Revision 1.11.2.9 2002/11/08 16:39:17 oes
-# Made img-reorder more cautious. Fixes bug #632715
-#
-# Revision 1.11.2.8 2002/10/13 21:56:52 hal9
-# Adding demoronizer filter. This should include all the common abuses. I have
-# left a few of the rare cases commented out (never found these in the wild).
-#
-# Revision 1.11.2.7 2002/09/25 15:09:39 oes
-# Preserve original quoting style in <img> tags wherever possible. Fixes Bug #605956
-#
-# Revision 1.11.2.6 2002/08/23 14:12:26 oes
-# Proofed frameset-borders against "fremaborder=0 border=0"
-#
-# Revision 1.11.2.5 2002/08/22 15:05:20 oes
-# Added Filter to make Quicktime movies saveable (thanks to aaron@linville.org for the idea)
-#
-# Revision 1.11.2.4 2002/08/10 11:32:29 oes
-# Attribute values in replacement tags of banners-by-size filter now undelimited. (Fixes bug #592493)
-#
-# Revision 1.11.2.3 2002/08/05 11:43:56 oes
-# Fixed a bug in the popups filter that was introduced with the last fix :-(
-#
-# Revision 1.11.2.2 2002/08/01 11:20:13 oes
-# Fixed bugs 587802, 577802 and an unreported one
-#
-# Revision 1.11.2.1 2002/07/26 15:18:26 oes
-# - All filters reviewed and many shorcomings fixed
-# - New filters: img-reorder, banners-by-link and js-events
-# - Jobs reorderd because they are now executed in order of
-# appearance
-#
-# Revision 1.11 2002/05/24 00:57:18 oes
-# Made WeBugs job ungreedy; Fixes bug 559190
-#
-# Revision 1.10 2002/04/18 10:14:19 oes
-# renamed some filters
-#
-# Revision 1.9 2002/04/11 07:36:35 oes
-# Generalized js-popup filter
-#
-# Revision 1.8 2002/04/10 17:07:21 oes
-# Fixed potentially desctructive jobs, added noflash filter
-#
-# Revision 1.7 2002/04/09 18:34:51 oes
-# Fixed HTML syntax in replacements
-#
-# Revision 1.6 2002/04/03 19:49:52 swa
-# name change
-#
-# Revision 1.5 2002/03/27 15:30:26 swa
-# have a consistent appearance
-#
-# Revision 1.4 2002/03/26 22:29:54 swa
-# we have a new homepage!
-#
-# Revision 1.3 2002/03/24 16:08:03 jongfoster
-# Fixing banners-by-size for new config URLs
-#
-# Revision 1.2 2002/03/24 13:02:18 swa
-# name change related issues.
-#
-# Revision 1.1 2002/03/24 11:37:39 jongfoster
-# Name change
-#
-# Revision 1.24 2002/03/16 20:39:54 oes
-# - Added descriptions to the filters so users will know what they select in the cgi editor
-# - Added content-cookies filter
-# - Bugfixed many jobs (Thanks to Al for some hints)
-#
-# Revision 1.22 2002/03/12 13:42:50 oes
-# Fixing & Optimizing REs
-#
-# Revision 1.21 2002/03/12 11:59:20 oes
-# Beefed up Buzzword Bingo
-#
-# Revision 1.20 2002/03/12 01:42:50 oes
-# Introduced modular filters
-#
-# Revision 1.19 2002/03/10 19:49:24 oes
-# Added expression to kill referer tracking in JavaScripts
-#
-# Revision 1.18 2002/03/08 17:14:12 oes
-# PNG -> image in comments
-#
-# Revision 1.17 2002/03/07 03:50:54 oes
-# Adapted comments to new built-in images
-#
-# Revision 1.16 2002/02/21 00:12:19 jongfoster
-# Modifying the banner regexps to use long URLS and to autodetect
-# whether to show a logo or a transparent GIF, based on actionsfile
-# setting.
-#
-# Revision 1.15 2001/12/28 23:54:20 steudten
-# Fix for feature Req #495374: http-equiv problem
-#
-# Revision 1.14 2001/12/09 18:55:11 david__schmidt
-# Updated CODE_STATUS to beta, commented out microsuck line in re_filterfile
-# for 2.9.10 beta
-#
-# Revision 1.13 2001/10/13 13:11:20 joergs
-# Fixed WebBug filter.
-#
-# Revision 1.12 2001/10/07 15:46:42 oes
-# Followed Guy's proposal to change the document.cookie job
-#
-# Revision 1.11 2001/09/21 12:34:00 joergs
-# Added filter to replace "Nimda" code by a warning.
-#
-# Revision 1.10 2001/07/20 11:04:26 oes
-# Added Rodneys javascript cookie filter
-#
-# Revision 1.9 2001/07/13 14:03:48 oes
-# Elimiated yet another bug in the banner-by-size jobs. Shame on me!
-#
-# Revision 1.8 2001/06/29 13:34:00 oes
-# - Added explanation for U and T options
-# - Added hint on image replacement by CGI call
-# - Fixed bug in banner-by-size jobs
-#
-# Revision 1.7 2001/06/19 14:21:56 oes
-# Fixed microsuck line
-#
-# Revision 1.6 2001/06/09 14:01:57 swa
-# header. cosmetics. default: no messing ala microsuck.
-#
This file belongs into
ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
- $Id: developer-manual.sgml,v 2.26 2009/02/12 16:08:26 fabiankeil Exp $
+ $Id: developer-manual.sgml,v 2.27 2009/02/19 02:20:22 hal9 Exp $
Copyright (C) 2001-2009 Privoxy Developers http://www.privoxy.org/
See LICENSE.
</pubdate>
- <pubdate>$Id: developer-manual.sgml,v 2.26 2009/02/12 16:08:26 fabiankeil Exp $</pubdate>
+ <pubdate>$Id: developer-manual.sgml,v 2.27 2009/02/19 02:20:22 hal9 Exp $</pubdate>
<!--
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ,
* USA
*
- * Revisions :
- * $L<!-- Break CVS Substitution -->og$
- *
*********************************************************************/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 ,
* USA
*
- * Revisions :
- * $L<!-- Break CVS Substitution -->og$
- *
*********************************************************************/
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
$Log: developer-manual.sgml,v $
+ Revision 2.27 2009/02/19 02:20:22 hal9
+ Make some links in seealso conditional. Man page is now privoxy only links.
+
Revision 2.26 2009/02/12 16:08:26 fabiankeil
Declare the code stable.
-const char encode_rcs[] = "$Id: encode.c,v 1.13 2007/08/18 14:34:27 fabiankeil Exp $";
+const char encode_rcs[] = "$Id: encode.c,v 1.14 2008/05/21 15:38:13 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/encode.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: encode.c,v $
- * Revision 1.13 2007/08/18 14:34:27 fabiankeil
- * Make xtoi() extern so it can be used in pcrs.c.
- *
- * Revision 1.12 2007/08/04 10:15:51 fabiankeil
- * Use strlcpy() instead of strcpy().
- *
- * Revision 1.11 2006/12/28 18:25:53 fabiankeil
- * Fixed gcc43 compiler warning.
- *
- * Revision 1.10 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.8 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.7 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.6 2002/03/13 00:27:04 jongfoster
- * Killing warnings
- *
- * Revision 1.5 2002/03/07 03:46:53 oes
- * Fixed compiler warnings etc
- *
- * Revision 1.4 2002/01/22 23:28:07 jongfoster
- * Adding convenience function html_encode_and_free_original()
- * Making all functions accept NULL paramaters - in this case, they
- * simply return NULL. This allows error-checking to be deferred.
- *
- * Revision 1.3 2001/11/13 00:16:40 jongfoster
- * Replacing references to malloc.h with the standard stdlib.h
- * (See ANSI or K&R 2nd Ed)
- *
- * Revision 1.2 2001/05/17 22:52:35 oes
- * - Cleaned CRLF's from the sources and related files
- *
- * Revision 1.1.1.1 2001/05/15 13:58:51 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef ENCODE_H_INCLUDED
#define ENCODE_H_INCLUDED
-#define ENCODE_H_VERSION "$Id: encode.h,v 1.8 2007/08/18 14:34:27 fabiankeil Exp $"
+#define ENCODE_H_VERSION "$Id: encode.h,v 1.9 2008/05/21 15:38:13 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/encode.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: encode.h,v $
- * Revision 1.8 2007/08/18 14:34:27 fabiankeil
- * Make xtoi() extern so it can be used in pcrs.c.
- *
- * Revision 1.7 2006/07/18 14:48:45 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.5 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.4 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.3 2002/01/22 23:28:07 jongfoster
- * Adding convenience function html_encode_and_free_original()
- * Making all functions accept NULL paramaters - in this case, they
- * simply return NULL. This allows error-checking to be deferred.
- *
- * Revision 1.2 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.1.1.1 2001/05/15 13:58:51 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char errlog_rcs[] = "$Id: errlog.c,v 1.91 2009/03/18 21:56:30 fabiankeil Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.92 2009/03/20 03:39:31 ler762 Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: errlog.c,v $
- * Revision 1.91 2009/03/18 21:56:30 fabiankeil
- * In init_error_log(), suppress the "(Re-)Opening logfile" message if
- * we're still logging to stderr. This restores the "silent mode", but
- * with LOG_LEVEL_INFO enabled, the show_version() info is written to
- * the logfile as intended.
- *
- * Revision 1.90 2009/03/18 20:43:19 fabiankeil
- * Don't enable LOG_LEVEL_INFO by default and don't apply the user's
- * debug settings until the logfile has been opened (if there is one).
- * Patch submitted by Roland in #2624120.
- *
- * Revision 1.89 2009/03/07 12:56:12 fabiankeil
- * Add log_error() support for unsigned long long (%lld).
- *
- * Revision 1.88 2009/03/07 11:34:36 fabiankeil
- * Omit timestamp and thread id in the mingw32 message box.
- *
- * Revision 1.87 2009/03/01 18:28:24 fabiankeil
- * Help clang understand that we aren't dereferencing
- * NULL pointers here.
- *
- * Revision 1.86 2009/02/09 21:21:15 fabiankeil
- * Now that init_log_module() is called earlier, call show_version()
- * later on from main() directly so it doesn't get called for --help
- * or --version.
- *
- * Revision 1.85 2009/02/06 17:51:38 fabiankeil
- * Be prepared if I break the log module initialization again.
- *
- * Revision 1.84 2008/12/14 15:46:22 fabiankeil
- * Give crunched requests their own log level.
- *
- * Revision 1.83 2008/12/04 18:14:32 fabiankeil
- * Fix some cparser warnings.
- *
- * Revision 1.82 2008/11/23 16:06:58 fabiankeil
- * Update a log message I missed in 1.80.
- *
- * Revision 1.81 2008/11/23 15:59:27 fabiankeil
- * - Update copyright range.
- * - Remove stray line breaks in a log message
- * nobody is supposed to see anyway.
- *
- * Revision 1.80 2008/11/23 15:49:49 fabiankeil
- * In log_error(), don't surround the thread id with "Privoxy(" and ")".
- *
- * Revision 1.79 2008/10/20 17:09:25 fabiankeil
- * Update init_error_log() description to match reality.
- *
- * Revision 1.78 2008/09/07 16:59:31 fabiankeil
- * Update a comment to reflect that we
- * have mutex support on mingw32 now.
- *
- * Revision 1.77 2008/09/07 12:43:44 fabiankeil
- * Move the LogPutString() call in log_error() into the locked
- * region so the Windows GUI log is consistent with the logfile.
- *
- * Revision 1.76 2008/09/07 12:35:05 fabiankeil
- * Add mutex lock support for _WIN32.
- *
- * Revision 1.75 2008/09/04 08:13:58 fabiankeil
- * Prepare for critical sections on Windows by adding a
- * layer of indirection before the pthread mutex functions.
- *
- * Revision 1.74 2008/08/06 18:33:36 fabiankeil
- * If the "close fd first" workaround doesn't work,
- * the fatal error message will be lost, so we better
- * explain the consequences while we still can.
- *
- * Revision 1.73 2008/08/04 19:06:55 fabiankeil
- * Add a lame workaround for the "can't open an already open
- * logfile on OS/2" problem reported by Maynard in #2028842
- * and describe what a real solution would look like.
- *
- * Revision 1.72 2008/07/27 12:04:28 fabiankeil
- * Fix a comment typo.
- *
- * Revision 1.71 2008/06/28 17:17:15 fabiankeil
- * Remove another stray semicolon.
- *
- * Revision 1.70 2008/06/28 17:10:29 fabiankeil
- * Remove stray semicolon in get_log_timestamp().
- * Reported by Jochen Voss in #2005221.
- *
- * Revision 1.69 2008/05/30 15:55:25 fabiankeil
- * Declare variable "debug" static and complain about its name.
- *
- * Revision 1.68 2008/04/27 16:50:46 fabiankeil
- * Remove an incorrect assertion. The value of debug may change if
- * the configuration is reloaded in another thread. While we could
- * cache the initial value, the assertion doesn't seem worth it.
- *
- * Revision 1.67 2008/03/27 18:27:23 fabiankeil
- * Remove kill-popups action.
- *
- * Revision 1.66 2008/01/31 15:38:14 fabiankeil
- * - Make the logfp assertion more strict. As of 1.63, the "||" could
- * have been an "&&", which means we can use two separate assertions
- * and skip on of them on Windows.
- * - Break a long commit message line in two.
- *
- * Revision 1.65 2008/01/31 14:44:33 fabiankeil
- * Use (a != b) instead of !(a == b) so the sanity check looks less insane.
- *
- * Revision 1.64 2008/01/21 18:56:46 david__schmidt
- * Swap #def from negative to positive, re-joined it so it didn't
- * span an assertion (compilation failure on OS/2)
- *
- * Revision 1.63 2007/12/15 19:49:32 fabiankeil
- * Stop overloading logfile to control the mingw32 log window as well.
- * It's no longer necessary now that we disable all debug lines by default
- * and at least one user perceived it as a regression (added in 1.55).
- *
- * Revision 1.62 2007/11/30 15:33:46 fabiankeil
- * Unbreak LOG_LEVEL_FATAL. It wasn't fatal with logging disabled
- * and on mingw32 fatal log messages didn't end up in the log file.
- *
- * Revision 1.61 2007/11/04 19:03:01 fabiankeil
- * Fix another deadlock Hal spotted and that mysteriously didn't affect FreeBSD.
- *
- * Revision 1.60 2007/11/03 19:03:31 fabiankeil
- * - Prevent the Windows GUI from showing the version two times in a row.
- * - Stop using the imperative in the "(Re-)Open logfile" message.
- * - Ditch the "Switching to daemon mode" message as the detection
- * whether or not we're already in daemon mode doesn't actually work.
- *
- * Revision 1.59 2007/11/01 12:50:56 fabiankeil
- * Here's looking at you, deadlock.
- *
- * Revision 1.58 2007/10/28 19:04:21 fabiankeil
- * Don't mention daemon mode in "Logging disabled" message. Some
- * platforms call it differently and it's not really relevant anyway.
- *
- * Revision 1.57 2007/10/27 13:02:26 fabiankeil
- * Relocate daemon-mode-related log messages to make sure
- * they aren't shown again in case of configuration reloads.
- *
- * Revision 1.56 2007/10/14 14:26:56 fabiankeil
- * Remove the old log_error() version.
- *
- * Revision 1.55 2007/10/14 14:12:41 fabiankeil
- * When in daemon mode, close stderr after the configuration file has been
- * parsed the first time. If logfile isn't set, stop logging. Fixes BR#897436.
- *
- * Revision 1.54 2007/09/22 16:15:34 fabiankeil
- * - Let it compile with pcc.
- * - Move our includes below system includes to prevent macro conflicts.
- *
- * Revision 1.53 2007/08/05 13:53:14 fabiankeil
- * #1763173 from Stefan Huehner: declare some more functions
- * static and use void instead of empty parameter lists.
- *
- * Revision 1.52 2007/07/14 07:28:47 fabiankeil
- * Add translation function for JB_ERR_FOO codes.
- *
- * Revision 1.51 2007/05/11 11:51:34 fabiankeil
- * Fix a type mismatch warning.
- *
- * Revision 1.50 2007/04/11 10:55:44 fabiankeil
- * Enforce some assertions that could be triggered
- * on mingw32 and other systems where we use threads
- * but no locks.
- *
- * Revision 1.49 2007/04/08 16:44:15 fabiankeil
- * We need <sys/time.h> for gettimeofday(), not <time.h>.
- *
- * Revision 1.48 2007/03/31 13:33:28 fabiankeil
- * Add alternative log_error() with timestamps
- * that contain milliseconds and without using
- * strcpy(), strcat() or sprintf().
- *
- * Revision 1.47 2006/11/28 15:25:15 fabiankeil
- * Only unlink the pidfile if it's actually used.
- *
- * Revision 1.46 2006/11/13 19:05:51 fabiankeil
- * Make pthread mutex locking more generic. Instead of
- * checking for OSX and OpenBSD, check for FEATURE_PTHREAD
- * and use mutex locking unless there is an _r function
- * available. Better safe than sorry.
- *
- * Fixes "./configure --disable-pthread" and should result
- * in less threading-related problems on pthread-using platforms,
- * but it still doesn't fix BR#1122404.
- *
- * Revision 1.45 2006/08/21 11:15:54 david__schmidt
- * MS Visual C++ build updates
- *
- * Revision 1.44 2006/08/18 16:03:16 david__schmidt
- * Tweak for OS/2 build happiness.
- *
- * Revision 1.43 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:
- * http://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.42 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.40.2.4 2005/04/03 20:10:50 david__schmidt
- * Thanks to Jindrich Makovicka for a race condition fix for the log
- * file. The race condition remains for non-pthread implementations.
- * Reference patch #1175720.
- *
- * Revision 1.40.2.3 2003/03/07 03:41:04 david__schmidt
- * Wrapping all *_r functions (the non-_r versions of them) with mutex
- * semaphores for OSX. Hopefully this will take care of all of those pesky
- * crash reports.
- *
- * Revision 1.40.2.2 2002/09/28 00:30:57 david__schmidt
- * Update error logging to give sane values for thread IDs on Mach kernels.
- * It's still a hack, but at least it looks farily normal. We print the
- * absolute value of the first 4 bytes of the pthread_t modded with 1000.
- *
- * Revision 1.40.2.1 2002/09/25 12:47:42 oes
- * Make log_error safe against NULL string arguments
- *
- * Revision 1.40 2002/05/22 01:27:27 david__schmidt
- *
- * Add os2_socket_strerr mirroring w32_socket_strerr.
- *
- * Revision 1.39 2002/04/03 17:15:27 gliptak
- * zero padding thread ids in log
- *
- * Revision 1.38 2002/03/31 17:18:59 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.37 2002/03/27 14:32:43 david__schmidt
- * More compiler warning message maintenance
- *
- * Revision 1.36 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.35 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.34 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.33 2002/03/13 00:27:04 jongfoster
- * Killing warnings
- *
- * Revision 1.32 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.31 2002/03/06 23:02:57 jongfoster
- * Removing tabs
- *
- * Revision 1.30 2002/03/05 22:43:45 david__schmidt
- * - Better error reporting on OS/2
- * - Fix double-slash comment (oops)
- *
- * Revision 1.29 2002/03/04 23:45:13 jongfoster
- * Printing thread ID if using Win32 native threads
- *
- * Revision 1.28 2002/03/04 17:59:59 oes
- * Deleted deletePidFile(), cosmetics
- *
- * Revision 1.27 2002/03/04 02:08:01 david__schmidt
- * Enable web editing of actions file on OS/2 (it had been broken all this time!)
- *
- * Revision 1.26 2002/01/09 19:05:45 steudten
- * Fix big memory leak.
- *
- * Revision 1.25 2002/01/09 14:32:08 oes
- * Added support for gmtime_r and localtime_r.
- *
- * Revision 1.24 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.23 2001/11/07 00:02:13 steudten
- * Add line number in error output for lineparsing for
- * actionsfile and configfile.
- * Special handling for CLF added.
- *
- * Revision 1.22 2001/11/05 23:43:05 steudten
- * Add time+date to log files.
- *
- * Revision 1.21 2001/10/25 03:40:47 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.20 2001/09/16 23:04:34 jongfoster
- * Fixing a warning
- *
- * Revision 1.19 2001/09/13 20:08:06 jongfoster
- * Adding support for LOG_LEVEL_CGI
- *
- * Revision 1.18 2001/09/10 11:27:24 oes
- * Declaration of w32_socket_strerr now conditional
- *
- * Revision 1.17 2001/09/10 10:17:13 oes
- * Removed unused variable; Fixed sprintf format
- *
- * Revision 1.16 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.15 2001/07/29 17:41:10 jongfoster
- * Now prints thread ID for each message (pthreads only)
- *
- * Revision 1.14 2001/07/19 19:03:48 haroon
- * - Added case for LOG_LEVEL_POPUPS
- *
- * Revision 1.13 2001/07/13 13:58:58 oes
- * - Added case for LOG_LEVEL_DEANIMATE
- * - Removed all #ifdef PCRS
- *
- * Revision 1.12 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.11 2001/06/01 18:14:49 jongfoster
- * Changing the calls to strerr() to check HAVE_STRERR (which is defined
- * in config.h if appropriate) rather than the NO_STRERR macro.
- *
- * Revision 1.10 2001/05/29 11:52:21 oes
- * Conditional compilation of w32_socket_error
- *
- * Revision 1.9 2001/05/28 16:15:17 jongfoster
- * Improved reporting of errors under Win32.
- *
- * Revision 1.8 2001/05/26 17:25:14 jongfoster
- * Added support for CLF (Common Log Format) and fixed LOG_LEVEL_LOG
- *
- * Revision 1.7 2001/05/26 15:21:28 jongfoster
- * Activity animation in Win32 GUI now works even if debug==0
- *
- * Revision 1.6 2001/05/25 21:55:08 jongfoster
- * Now cleans up properly on FATAL (removes taskbar icon etc)
- *
- * Revision 1.5 2001/05/22 18:46:04 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.4 2001/05/21 19:32:54 jongfoster
- * Added another #ifdef _WIN_CONSOLE
- *
- * Revision 1.3 2001/05/20 01:11:40 jongfoster
- * Added support for LOG_LEVEL_FATAL
- * Renamed LOG_LEVEL_FRC to LOG_LEVEL_FORCE,
- * and LOG_LEVEL_REF to LOG_LEVEL_RE_FILTER
- *
- * Revision 1.2 2001/05/17 22:42:01 oes
- * - Cleaned CRLF's from the sources and related files
- * - Repaired logging for REF and FRC
- *
- * Revision 1.1.1.1 2001/05/15 13:58:51 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include <stdlib.h>
#include <stdio.h>
#ifndef ERRLOG_H_INCLUDED
#define ERRLOG_H_INCLUDED
-#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.21 2008/12/14 15:46:22 fabiankeil Exp $"
+#define ERRLOG_H_VERSION "$Id: errlog.h,v 1.22 2009/02/09 21:21:15 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: errlog.h,v $
- * Revision 1.21 2008/12/14 15:46:22 fabiankeil
- * Give crunched requests their own log level.
- *
- * Revision 1.20 2008/03/27 18:27:23 fabiankeil
- * Remove kill-popups action.
- *
- * Revision 1.19 2007/10/14 14:12:41 fabiankeil
- * When in daemon mode, close stderr after the configuration file has been
- * parsed the first time. If logfile isn't set, stop logging. Fixes BR#897436.
- *
- * Revision 1.18 2007/07/14 07:28:47 fabiankeil
- * Add translation function for JB_ERR_FOO codes.
- *
- * Revision 1.17 2007/03/31 13:33:28 fabiankeil
- * Add alternative log_error() with timestamps
- * that contain milliseconds and without using
- * strcpy(), strcat() or sprintf().
- *
- * Revision 1.16 2006/11/28 15:29:50 fabiankeil
- * Define LOG_LEVEL_REDIRECTS independently of
- * FEATURE_FAST_REDIRECTS. It is used by redirect{}
- * as well.
- *
- * Revision 1.15 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.13.2.1 2002/08/05 17:57:06 oes
- * Cosmetic change
- *
- * Revision 1.13 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.12 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.11 2002/03/06 23:02:57 jongfoster
- * Removing tabs
- *
- * Revision 1.10 2001/09/13 20:08:06 jongfoster
- * Adding support for LOG_LEVEL_CGI
- *
- * Revision 1.9 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.8 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.7 2001/07/19 19:02:53 haroon
- * Added define for LOG_LEVEL_POPUPS
- *
- * Revision 1.6 2001/07/13 13:59:22 oes
- * - Added LOG_LEVEL_DEANIMATE
- * - Changed LOG_LEVEL_CLF
- * - Removed all #ifdef PCRS
- *
- * Revision 1.5 2001/05/26 17:25:14 jongfoster
- * Added support for CLF (Common Log Format) and fixed LOG_LEVEL_LOG
- *
- * Revision 1.4 2001/05/25 21:56:06 jongfoster
- * Added FIXME comment to (broken) LOG_LEVEL_LOG
- *
- * Revision 1.3 2001/05/22 18:46:04 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.2 2001/05/20 01:11:40 jongfoster
- * Added support for LOG_LEVEL_FATAL
- * Renamed LOG_LEVEL_FRC to LOG_LEVEL_FORCE,
- * and LOG_LEVEL_REF to LOG_LEVEL_RE_FILTER
- *
- * Revision 1.1.1.1 2001/05/15 13:58:51 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char filters_rcs[] = "$Id: filters.c,v 1.119 2009/04/17 11:38:28 fabiankeil Exp $";
+const char filters_rcs[] = "$Id: filters.c,v 1.120 2009/04/17 11:45:19 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: filters.c,v $
- * Revision 1.119 2009/04/17 11:38:28 fabiankeil
- * Add and use parse_forwarder_address() to reduce code duplication.
- *
- * Revision 1.118 2009/04/17 11:37:03 fabiankeil
- * Allow IPv6 addresses in forward-override{}.
- *
- * Revision 1.117 2009/04/17 11:35:28 fabiankeil
- * Fix compiler warning.
- *
- * Revision 1.116 2009/04/17 11:34:34 fabiankeil
- * Style cosmetics for the IPv6 code.
- *
- * Revision 1.115 2009/04/17 11:29:18 fabiankeil
- * Compile fix for BSD libc.
- *
- * Revision 1.114 2009/04/17 11:27:49 fabiankeil
- * Petr Pisar's privoxy-3.0.12-ipv6-3.diff.
- *
- * Revision 1.113 2009/03/08 14:19:23 fabiankeil
- * Fix justified (but harmless) compiler warnings
- * on platforms where sizeof(int) < sizeof(long).
- *
- * Revision 1.112 2009/03/01 18:28:23 fabiankeil
- * Help clang understand that we aren't dereferencing
- * NULL pointers here.
- *
- * Revision 1.111 2008/12/04 18:13:46 fabiankeil
- * Fix a cparser warning.
- *
- * Revision 1.110 2008/11/10 16:40:25 fabiankeil
- * Fix a gcc44 warning.
- *
- * Revision 1.109 2008/11/08 15:48:41 fabiankeil
- * Mention actual values when complaining about
- * the chunk size exceeding the buffer size.
- *
- * Revision 1.108 2008/05/21 15:35:08 fabiankeil
- * - Mark csp as immutable for block_acl().
- * - Remove an obsolete complaint about filter_popups().
- *
- * Revision 1.107 2008/05/04 17:52:56 fabiankeil
- * Adjust parse_http_url() call to new prototype.
- *
- * Revision 1.106 2008/05/03 16:40:44 fabiankeil
- * Change content_filters_enabled()'s parameter from
- * csp->action to action so it can be also used in the
- * CGI code. Don't bother checking if there are filters
- * loaded, as that's somewhat besides the point.
- *
- * Revision 1.105 2008/03/28 15:13:39 fabiankeil
- * Remove inspect-jpegs action.
- *
- * Revision 1.104 2008/03/27 18:27:24 fabiankeil
- * Remove kill-popups action.
- *
- * Revision 1.103 2008/03/06 16:33:45 fabiankeil
- * If limit-connect isn't used, don't limit CONNECT requests to port 443.
- *
- * Revision 1.102 2008/03/01 14:00:44 fabiankeil
- * Let the block action take the reason for the block
- * as argument and show it on the "blocked" page.
- *
- * Revision 1.101 2008/02/23 16:57:12 fabiankeil
- * Rename url_actions() to get_url_actions() and let it
- * use the standard parameter ordering.
- *
- * Revision 1.100 2008/02/23 16:33:43 fabiankeil
- * Let forward_url() use the standard parameter ordering
- * and mark its second parameter immutable.
- *
- * Revision 1.99 2008/02/03 13:57:58 fabiankeil
- * Add SOCKS5 support for forward-override{}.
- *
- * Revision 1.98 2008/01/04 17:43:45 fabiankeil
- * Improve the warning messages that get logged if the action files
- * "enable" filters but no filters of that type have been loaded.
- *
- * Revision 1.97 2007/11/30 15:37:03 fabiankeil
- * Use freez instead of free.
- *
- * Revision 1.96 2007/10/19 16:53:28 fabiankeil
- * Add helper function to check if any content filters are enabled.
- *
- * 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.
- *
- * Revision 1.93 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.92 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
- * care about de-chunking and decompression. As a side effect this enables
- * decompression for gif_deanimate_response() and jpeg_inspect_response().
- * - Change remove_chunked_transfer_coding()'s return type to jb_err.
- * Some clowns feel like chunking empty responses in which case
- * (size == 0) is valid but previously would be interpreted as error.
- *
- * Revision 1.91 2007/09/02 15:31:20 fabiankeil
- * Move match_portlist() from filter.c to urlmatch.c.
- * It's used for url matching, not for filtering.
- *
- * Revision 1.90 2007/09/02 12:44:17 fabiankeil
- * Remove newline at the end of a log_error() message.
- *
- * Revision 1.89 2007/08/05 13:42:23 fabiankeil
- * #1763173 from Stefan Huehner: declare some more functions static.
- *
- * Revision 1.88 2007/06/01 16:41:11 fabiankeil
- * Add forward-override{} to change the forwarding settings through
- * action sections. This is mainly interesting to forward different
- * clients differently (for example based on User-Agent or request
- * origin).
- *
- * Revision 1.87 2007/04/30 15:53:10 fabiankeil
- * Make sure filters with dynamic jobs actually use them.
- *
- * Revision 1.86 2007/04/30 15:03:28 fabiankeil
- * - Introduce dynamic pcrs jobs that can resolve variables.
- * - Don't run redirect functions more than once,
- * unless they are activated more than once.
- *
- * Revision 1.85 2007/03/21 12:24:47 fabiankeil
- * - Log the content size after decompression in decompress_iob()
- * instead of pcrs_filter_response().
- *
- * Revision 1.84 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.83 2007/03/17 15:20:05 fabiankeil
- * New config option: enforce-blocks.
- *
- * Revision 1.82 2007/03/13 11:28:43 fabiankeil
- * - Fix port handling in acl_addr() and use a temporary acl spec
- * copy so error messages don't contain a truncated version.
- * - Log size of iob before and after decompression.
- *
- * Revision 1.81 2007/03/05 14:40:53 fabiankeil
- * - Cosmetical changes for LOG_LEVEL_RE_FILTER messages.
- * - Hide the "Go there anyway" link for blocked CONNECT
- * requests where going there anyway doesn't work anyway.
- *
- * Revision 1.80 2007/02/07 10:55:20 fabiankeil
- * - Save the reason for generating http_responses.
- * - Block (+block) with status code 403 instead of 404.
- * - Use a different kludge to remember a failed decompression.
- *
- * Revision 1.79 2007/01/31 16:21:38 fabiankeil
- * Search for Max-Forwards headers case-insensitive,
- * don't generate the "501 unsupported" message for invalid
- * Max-Forwards values and don't increase negative ones.
- *
- * Revision 1.78 2007/01/28 13:41:18 fabiankeil
- * - Add HEAD support to finish_http_response.
- * - Add error favicon to internal HTML error messages.
- *
- * Revision 1.77 2007/01/12 15:36:44 fabiankeil
- * Mark *csp as immutable for is_untrusted_url()
- * and is_imageurl(). Closes FR 1237736.
- *
- * Revision 1.76 2007/01/01 19:36:37 fabiankeil
- * Integrate a modified version of Wil Mahan's
- * zlib patch (PR #895531).
- *
- * Revision 1.75 2006/12/29 18:30:46 fabiankeil
- * Fixed gcc43 conversion warnings,
- * changed sprintf calls to snprintf.
- *
- * Revision 1.74 2006/12/24 17:37:38 fabiankeil
- * Adjust comment in pcrs_filter_response()
- * to recent pcrs changes. Hohoho.
- *
- * Revision 1.73 2006/12/23 16:01:02 fabiankeil
- * Don't crash if pcre returns an error code
- * that pcrs didn't expect. Fixes BR 1621173.
- *
- * Revision 1.72 2006/12/22 18:52:53 fabiankeil
- * Modified is_untrusted_url to complain in case of
- * write errors and to give a reason when adding new
- * entries to the trustfile. Closes FR 1097611.
- *
- * Revision 1.71 2006/12/22 14:24:52 fabiankeil
- * Skip empty filter files in pcrs_filter_response,
- * but don't ignore the ones that come afterwards.
- * Fixes parts of BR 1619208.
- *
- * Revision 1.70 2006/12/09 13:33:15 fabiankeil
- * Added some sanity checks for get_last_url().
- * Fixed possible segfault caused by my last commit.
- *
- * Revision 1.69 2006/12/08 12:39:13 fabiankeil
- * Let get_last_url() catch https URLs as well.
- *
- * Revision 1.68 2006/12/05 14:45:48 fabiankeil
- * Make sure get_last_url() behaves like advertised
- * and fast-redirects{} can be combined with redirect{}.
- *
- * Revision 1.67 2006/11/28 15:19:43 fabiankeil
- * Implemented +redirect{s@foo@bar@} to generate
- * a redirect based on a rewritten version of the
- * original URL.
- *
- * Revision 1.66 2006/09/23 13:26:38 roro
- * Replace TABs by spaces in source code.
- *
- * Revision 1.65 2006/09/21 12:54:43 fabiankeil
- * Fix +redirect{}. Didn't work with -fast-redirects.
- *
- * Revision 1.64 2006/08/31 10:55:49 fabiankeil
- * Block requests for untrusted URLs with status
- * code 403 instead of 200.
- *
- * Revision 1.63 2006/08/31 10:11:28 fabiankeil
- * Don't free p which is still in use and will be later
- * freed by free_map(). Don't claim the referrer is unknown
- * when the client didn't set one.
- *
- * Revision 1.62 2006/08/14 00:27:47 david__schmidt
- * Feature request 595948: Re-Filter logging in single line
- *
- * Revision 1.61 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.60 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.58.2.9 2006/01/29 23:10:56 david__schmidt
- * Multiple filter file support
- *
- * Revision 1.58.2.8 2005/05/07 21:50:55 david__schmidt
- * A few memory leaks plugged (mostly on error paths)
- *
- * Revision 1.58.2.7 2004/10/03 12:53:32 david__schmidt
- * Add the ability to check jpeg images for invalid
- * lengths of comment blocks. Defensive strategy
- * against the exploit:
- * Microsoft Security Bulletin MS04-028
- * Buffer Overrun in JPEG Processing (GDI+) Could
- * Allow Code Execution (833987)
- * Enabled with +inspect-jpegs in actions files.
- *
- * Revision 1.58.2.6 2003/12/06 22:18:27 gliptak
- * Correcting compile problem with FEATURE_IMAGE_BLOCKING
- *
- * Revision 1.58.2.5 2003/11/11 13:10:31 oes
- * Fixed bug #839859: "See why" link URL now gets url-encoded.
- *
- * Revision 1.58.2.4 2003/02/28 12:52:45 oes
- * Fixed a typo
- *
- * Revision 1.58.2.3 2002/09/25 14:51:51 oes
- * Added basic support for OPTIONS and TRACE HTTP methods:
- * New function direct_response which handles OPTIONS and
- * TRACE requests whose Max-Forwards header field is zero.
- *
- * Revision 1.58.2.2 2002/08/01 17:18:28 oes
- * Fixed BR 537651 / SR 579724 (MSIE image detect improper for IE/Mac)
- *
- * Revision 1.58.2.1 2002/07/26 15:18:53 oes
- * - Bugfix: Executing a filters without jobs no longer results in
- * turing off *all* filters.
- * - Security fix: Malicious web servers can't cause a seg fault
- * through bogus chunk sizes anymore
- *
- * Revision 1.58 2002/04/24 02:11:17 oes
- * Jon's multiple AF patch: url_actions now evaluates rules
- * from all AFs.
- *
- * Revision 1.57 2002/04/08 20:38:34 swa
- * fixed JB spelling
- *
- * Revision 1.56 2002/04/05 15:51:24 oes
- * - bugfix: error-pages now get correct request protocol
- * - fix for invalid HTML in trust info
- *
- * Revision 1.55 2002/04/02 16:13:51 oes
- * Fix: No "Go there anyway" for SSL
- *
- * Revision 1.54 2002/04/02 14:55:56 oes
- * Bugfix: is_untrusted_url() now depends on FEATURE_TRUST, not FEATURE_COOKIE_JAR
- *
- * Revision 1.53 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.52 2002/03/24 16:35:57 jongfoster
- * Removing logo
- *
- * Revision 1.51 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.50 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.49 2002/03/16 20:29:14 oes
- * Cosmetics
- *
- * Revision 1.48 2002/03/13 20:25:34 oes
- * Better logging for content filters
- *
- * Revision 1.47 2002/03/13 00:30:52 jongfoster
- * Killing warnings
- * Added option of always sending redirect for imageblock,
- * currently disabled with #if 0.
- *
- * Revision 1.46 2002/03/12 01:42:49 oes
- * Introduced modular filters
- *
- * Revision 1.45 2002/03/08 16:47:50 oes
- * Added choice beween GIF and PNG built-in images
- *
- * Revision 1.44 2002/03/07 03:49:31 oes
- * - Fixed compiler warnings etc
- * - Changed built-in images from GIF to PNG
- * (with regard to Unisys patent issue)
- * - Added a 4x4 pattern PNG which is less intrusive
- * than the logo but also clearly marks the deleted banners
- *
- * Revision 1.43 2002/01/22 23:51:59 jongfoster
- * Replacing strsav() with the safer string_append().
- *
- * Adding missing html_encode() to error message generators. Where encoded
- * and unencoded versions of a string were provided, removing the unencoded
- * one.
- *
- * Revision 1.42 2002/01/17 21:00:32 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Using a single, simple url_match(pattern,url) function - rather than
- * the 3-line match routine which was repeated all over the place.
- *
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Using parse_http_url() to parse URLs without faking a HTTP
- * request line for parse_http_request().
- *
- * Revision 1.41 2001/11/13 00:14:07 jongfoster
- * Fixing stupid bug now I've figured out what || means.
- * (It always returns 0 or 1, not one of it's paramaters.)
- *
- * Revision 1.40 2001/10/26 17:37:55 oes
- * - Re-enabled Netscape 200/404 bug workaround in block_url():
- * - Removed OS/2 special case
- * - Made block_url() independant from sed() having been run
- * - Made trust_url independant from sed() having been run
- * - Made is_imageurl independant from sed() having been run.
- * It now checks User-Agent: and Accept: by itself.
- *
- *
- * Revision 1.39 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.38 2001/10/23 21:32:33 jongfoster
- * Adding error-checking to selected functions
- *
- * Revision 1.37 2001/10/22 15:33:56 david__schmidt
- * Special-cased OS/2 out of the Netscape-abort-on-404-in-js problem in
- * filters.c. Added a FIXME in front of the offending code. I'll gladly
- * put in a better/more robust fix for all parties if one is presented...
- * It seems that just returning 200 instead of 404 would pretty much fix
- * it for everyone, but I don't know all the history of the problem.
- *
- * Revision 1.36 2001/10/10 16:44:16 oes
- * Added match_portlist function
- *
- * Revision 1.35 2001/10/07 15:41:23 oes
- * Replaced 6 boolean members of csp with one bitmap (csp->flags)
- *
- * New function remove_chunked_transfer_coding that strips chunked
- * transfer coding to plain and is called by pcrs_filter_response
- * and gif_deanimate_response if neccessary
- *
- * Improved handling of zero-change re_filter runs
- *
- * pcrs_filter_response and gif_deanimate_response now remove
- * chunked transfer codeing before processing the body.
- *
- * Revision 1.34 2001/09/20 15:49:36 steudten
- *
- * Fix BUG: Change int size to size_t size in pcrs_filter_response().
- * See cgi.c fill_template().
- *
- * Revision 1.33 2001/09/16 17:05:14 jongfoster
- * Removing unused #include showarg.h
- *
- * Revision 1.32 2001/09/16 13:21:27 jongfoster
- * Changes to use new list functions.
- *
- * Revision 1.31 2001/09/16 11:38:02 jongfoster
- * Splitting fill_template() into 2 functions:
- * template_load() loads the file
- * template_fill() performs the PCRS regexps.
- * This is because the CGI edit interface has a "table row"
- * template which is used many times in the page - this
- * change means it's only loaded from disk once.
- *
- * Revision 1.30 2001/09/16 11:00:10 jongfoster
- * New function alloc_http_response, for symmetry with free_http_response
- *
- * Revision 1.29 2001/09/13 23:32:40 jongfoster
- * Moving image data to cgi.c rather than cgi.h
- * Fixing a GPF under Win32 (and any other OS that protects global
- * constants from being written to).
- *
- * Revision 1.28 2001/09/10 10:18:51 oes
- * Silenced compiler warnings
- *
- * Revision 1.27 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.26 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.25 2001/07/26 10:09:46 oes
- * Made browser detection a little less naive
- *
- * Revision 1.24 2001/07/25 17:22:51 oes
- * Added workaround for Netscape bug that prevents display of page when loading a component fails.
- *
- * Revision 1.23 2001/07/23 13:40:12 oes
- * Fixed bug that caused document body to be dropped when pcrs joblist was empty.
- *
- * Revision 1.22 2001/07/18 12:29:34 oes
- * - Made gif_deanimate_response respect
- * csp->action->string[ACTION_STRING_DEANIMATE]
- * - Logging cosmetics
- *
- * Revision 1.21 2001/07/13 13:59:53 oes
- * - Introduced gif_deanimate_response which shares the
- * generic content modification interface of pcrs_filter_response
- * and acts as a wrapper to deanimate.c:gif_deanimate()
- * - Renamed re_process_buffer to pcrs_filter_response
- * - pcrs_filter_response now returns NULL on failiure
- * - Removed all #ifdef PCRS
- *
- * Revision 1.20 2001/07/01 17:01:04 oes
- * Added comments and missing return statement in is_untrusted_url()
- *
- * Revision 1.19 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.18 2001/06/29 13:27:38 oes
- * - Cleaned up, renamed and reorderd functions
- * and improved comments
- *
- * - block_url:
- * - Ported to CGI platform. Now delivers
- * http_response or NULL
- * - Unified HTML and GIF generation (moved image detection
- * and GIF generation here from jcc.c:chat())
- * - Fixed HTTP status to:
- * - 403 (Forbidden) for the "blocked" HTML message
- * - 200 (OK) for GIF answers
- * - 302 (Redirect) for redirect to GIF
- *
- * - trust_url:
- * - Ported to CGI platform. Now delivers
- * http_response or NULL
- * - Separated detection of untrusted URL into
- * (bool)is_untrusted_url
- * - Added enforcement of untrusted requests
- *
- * - Moved redirect_url() from cgi.c to here
- * and ported it to the CGI platform
- *
- * - Removed logentry from cancelled commit
- *
- * Revision 1.17 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.16 2001/06/07 23:10:26 jongfoster
- * Allowing unanchored domain patterns to back off and retry
- * if they partially match. Optimized right-anchored patterns.
- * Moving ACL and forward files into config file.
- * Replacing struct gateway with struct forward_spec
- *
- * Revision 1.15 2001/06/03 19:12:00 oes
- * extracted-CGI relevant stuff
- *
- * Revision 1.14 2001/06/01 10:30:55 oes
- * Added optional left-anchoring to domaincmp
- *
- * Revision 1.13 2001/05/31 21:21:30 jongfoster
- * Permissionsfile / actions file changes:
- * - Changed "permission" to "action" throughout
- * - changes to file format to allow string parameters
- * - Moved helper functions to actions.c
- *
- * Revision 1.12 2001/05/31 17:35:20 oes
- *
- * - Enhanced domain part globbing with infix and prefix asterisk
- * matching and optional unanchored operation
- *
- * Revision 1.11 2001/05/29 11:53:23 oes
- * "See why" link added to "blocked" page
- *
- * Revision 1.10 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.9 2001/05/27 22:17:04 oes
- *
- * - re_process_buffer no longer writes the modified buffer
- * to the client, which was very ugly. It now returns the
- * buffer, which it is then written by chat.
- *
- * - content_length now adjusts the Content-Length: header
- * for modified documents rather than crunch()ing it.
- * (Length info in csp->content_length, which is 0 for
- * unmodified documents)
- *
- * - For this to work, sed() is called twice when filtering.
- *
- * Revision 1.8 2001/05/26 17:13:28 jongfoster
- * Filled in a function comment.
- *
- * Revision 1.7 2001/05/26 15:26:15 jongfoster
- * ACL feature now provides more security by immediately dropping
- * connections from untrusted hosts.
- *
- * Revision 1.6 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.5 2001/05/25 22:34:30 jongfoster
- * Hard tabs->Spaces
- *
- * Revision 1.4 2001/05/22 18:46:04 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.3 2001/05/20 16:44:47 jongfoster
- * Removing last hardcoded Junkbusters.com URLs.
- *
- * 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:58:52 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef FILTERS_H_INCLUDED
#define FILTERS_H_INCLUDED
-#define FILTERS_H_VERSION "$Id: filters.h,v 1.35 2008/05/03 16:40:45 fabiankeil Exp $"
+#define FILTERS_H_VERSION "$Id: filters.h,v 1.36 2008/05/21 15:35:08 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/filters.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: filters.h,v $
- * Revision 1.35 2008/05/03 16:40:45 fabiankeil
- * Change content_filters_enabled()'s parameter from
- * csp->action to action so it can be also used in the
- * CGI code. Don't bother checking if there are filters
- * loaded, as that's somewhat besides the point.
- *
- * Revision 1.34 2008/03/02 12:25:25 fabiankeil
- * Also use shiny new connect_port_is_forbidden() in jcc.c.
- *
- * Revision 1.33 2008/02/23 16:57:12 fabiankeil
- * Rename url_actions() to get_url_actions() and let it
- * use the standard parameter ordering.
- *
- * Revision 1.32 2008/02/23 16:33:43 fabiankeil
- * Let forward_url() use the standard parameter ordering
- * and mark its second parameter immutable.
- *
- * Revision 1.31 2007/10/19 16:53:28 fabiankeil
- * Add helper function to check if any content filters are enabled.
- *
- * 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
- * care about de-chunking and decompression. As a side effect this enables
- * decompression for gif_deanimate_response() and jpeg_inspect_response().
- * - Change remove_chunked_transfer_coding()'s return type to jb_err.
- * Some clowns feel like chunking empty responses in which case
- * (size == 0) is valid but previously would be interpreted as error.
- *
- * Revision 1.28 2007/09/02 15:31:20 fabiankeil
- * Move match_portlist() from filter.c to urlmatch.c.
- * It's used for url matching, not for filtering.
- *
- * Revision 1.27 2007/04/30 15:02:18 fabiankeil
- * Introduce dynamic pcrs jobs that can resolve variables.
- *
- * Revision 1.26 2007/03/13 11:28:43 fabiankeil
- * - Fix port handling in acl_addr() and use a temporary acl spec
- * copy so error messages don't contain a truncated version.
- * - Log size of iob before and after decompression.
- *
- * Revision 1.25 2007/01/12 15:36:44 fabiankeil
- * Mark *csp as immutable for is_untrusted_url()
- * and is_imageurl(). Closes FR 1237736.
- *
- * Revision 1.24 2006/12/29 18:30:46 fabiankeil
- * Fixed gcc43 conversion warnings,
- * changed sprintf calls to snprintf.
- *
- * Revision 1.23 2006/11/28 15:19:43 fabiankeil
- * Implemented +redirect{s@foo@bar@} to generate
- * a redirect based on a rewritten version of the
- * original URL.
- *
- * Revision 1.22 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.20.2.2 2004/10/03 12:53:32 david__schmidt
- * Add the ability to check jpeg images for invalid
- * lengths of comment blocks. Defensive strategy
- * against the exploit:
- * Microsoft Security Bulletin MS04-028
- * Buffer Overrun in JPEG Processing (GDI+) Could
- * Allow Code Execution (833987)
- * Enabled with +inspect-jpegs in actions files.
- *
- * Revision 1.20.2.1 2002/09/25 14:51:51 oes
- * Added basic support for OPTIONS and TRACE HTTP methods:
- * New function direct_response which handles OPTIONS and
- * TRACE requests whose Max-Forwards header field is zero.
- *
- * Revision 1.20 2002/04/02 14:56:16 oes
- * Bugfix: is_untrusted_url() and trust_url() now depend on FEATURE_TRUST, not FEATURE_COOKIE_JAR
- *
- * Revision 1.19 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.18 2002/03/25 22:12:45 oes
- * Added fix for undefined INADDR_NONE on Solaris by Bart Schelstraete
- *
- * Revision 1.17 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.16 2002/01/17 21:01:02 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Revision 1.15 2001/10/10 16:44:16 oes
- * Added match_portlist function
- *
- * Revision 1.14 2001/10/07 15:41:40 oes
- * Added prototype for remove_chunked_transfer_coding
- *
- * Revision 1.13 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.12 2001/07/29 19:01:11 jongfoster
- * Changed _FILENAME_H to FILENAME_H_INCLUDED.
- * Added forward declarations for needed structures.
- *
- * Revision 1.11 2001/07/13 14:00:18 oes
- * - Introduced gif_deanimate_response
- * - Renamed re_process_buffer to pcrs_filter_response
- * - Removed all #ifdef PCRS
- *
- * Revision 1.10 2001/06/29 13:29:01 oes
- * Cleaned up and updated to reflect the changesin
- * filters.c
- *
- * Revision 1.9 2001/06/07 23:10:53 jongfoster
- * Replacing struct gateway with struct forward_spec
- *
- * Revision 1.8 2001/06/03 19:12:00 oes
- * extracted-CGI relevant stuff
- *
- * Revision 1.7 2001/05/31 21:21:30 jongfoster
- * Permissionsfile / actions file changes:
- * - Changed "permission" to "action" throughout
- * - changes to file format to allow string parameters
- * - Moved helper functions to actions.c
- *
- * Revision 1.6 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.5 2001/05/27 22:17:04 oes
- *
- * - re_process_buffer no longer writes the modified buffer
- * to the client, which was very ugly. It now returns the
- * buffer, which it is then written by chat.
- *
- * - content_length now adjusts the Content-Length: header
- * for modified documents rather than crunch()ing it.
- * (Length info in csp->content_length, which is 0 for
- * unmodified documents)
- *
- * - For this to work, sed() is called twice when filtering.
- *
- * Revision 1.4 2001/05/26 15:26:15 jongfoster
- * ACL feature now provides more security by immediately dropping
- * connections from untrusted hosts.
- *
- * Revision 1.3 2001/05/22 18:46:04 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * 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:58:52 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "project.h"
-const char gateway_rcs[] = "$Id: gateway.c,v 1.51 2009/05/13 18:20:54 fabiankeil Exp $";
+const char gateway_rcs[] = "$Id: gateway.c,v 1.52 2009/05/13 18:22:45 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: gateway.c,v $
- * Revision 1.51 2009/05/13 18:20:54 fabiankeil
- * There's no reason for keep_alive_timeout to be signed.
- *
- * Revision 1.50 2009/05/10 10:19:23 fabiankeil
- * Reenable server-side-only keep-alive support, but only share
- * outgoing connections if the connection-sharing option is set.
- *
- * Revision 1.49 2009/05/10 10:12:30 fabiankeil
- * Initial keep-alive support for the client socket.
- * Temporarily disable the server-side-only keep-alive code.
- *
- * Revision 1.48 2009/02/13 17:20:36 fabiankeil
- * Reword keep-alive support warning and only show
- * it #if !defined(HAVE_POLL) && !defined(_WIN32).
- *
- * Revision 1.47 2008/12/24 17:06:19 fabiankeil
- * Keep a thread around to timeout alive connections
- * even if no new requests are coming in.
- *
- * Revision 1.46 2008/12/13 11:07:23 fabiankeil
- * Remove duplicated debugging checks
- * in connection_destination_matches().
- *
- * Revision 1.45 2008/12/04 18:17:07 fabiankeil
- * Fix some cparser warnings.
- *
- * Revision 1.44 2008/11/22 11:54:04 fabiankeil
- * Move log message around to include the socket number.
- *
- * Revision 1.43 2008/11/13 09:15:51 fabiankeil
- * Make keep_alive_timeout static.
- *
- * Revision 1.42 2008/11/13 09:08:42 fabiankeil
- * Add new config option: keep-alive-timeout.
- *
- * Revision 1.41 2008/11/08 15:29:58 fabiankeil
- * Unify two debug messages.
- *
- * Revision 1.40 2008/11/08 15:14:05 fabiankeil
- * Fix duplicated debugging check.
- *
- * Revision 1.39 2008/10/25 11:33:01 fabiankeil
- * Remove already out-commented line left over from debugging.
- *
- * Revision 1.38 2008/10/24 17:33:00 fabiankeil
- * - Tone the "keep-alive support is experimental" warning
- * down a bit as hackish 0-chunk detection has been
- * implemented recently.
- * - Only show the "ndef HAVE_POLL" warning once on start-up.
- *
- * Revision 1.37 2008/10/23 17:40:53 fabiankeil
- * Fix forget_connection() and mark_connection_unused(),
- * which would both under certain circumstances access
- * reusable_connection[MAX_REUSABLE_CONNECTIONS]. Oops.
- *
- * Revision 1.36 2008/10/18 19:49:15 fabiankeil
- * - Factor close_unusable_connections() out of
- * get_reusable_connection() to make sure we really check
- * all the remembered connections, not just the ones before
- * the next reusable one.
- * - Plug two file descriptor leaks. Internally marking
- * connections as closed doesn't cut it.
- *
- * Revision 1.35 2008/10/17 17:12:01 fabiankeil
- * In socket_is_still_usable(), use select()
- * and FD_ISSET() if poll() isn't available.
- *
- * Revision 1.34 2008/10/17 17:07:13 fabiankeil
- * Add preliminary timeout support.
- *
- * Revision 1.33 2008/10/16 16:34:21 fabiankeil
- * Fix two gcc44 warnings.
- *
- * Revision 1.32 2008/10/16 16:27:22 fabiankeil
- * Fix compiler warning.
- *
- * Revision 1.31 2008/10/16 07:31:11 fabiankeil
- * - Factor socket_is_still_usable() out of get_reusable_connection().
- * - If poll() isn't available, show a warning and assume the socket
- * is still usable.
- *
- * Revision 1.30 2008/10/13 17:31:03 fabiankeil
- * If a remembered connection is no longer usable and
- * has been marked closed, don't bother checking if the
- * destination matches.
- *
- * Revision 1.29 2008/10/11 16:59:41 fabiankeil
- * Add missing dots for two log messages.
- *
- * Revision 1.28 2008/10/09 18:21:41 fabiankeil
- * Flush work-in-progress changes to keep outgoing connections
- * alive where possible. Incomplete and mostly #ifdef'd out.
- *
- * Revision 1.27 2008/09/27 15:05:51 fabiankeil
- * Return only once in forwarded_connect().
- *
- * Revision 1.26 2008/08/18 17:42:06 fabiankeil
- * Fix typo in macro name.
- *
- * Revision 1.25 2008/02/07 18:09:46 fabiankeil
- * In socks5_connect:
- * - make the buffers quite a bit smaller.
- * - properly report "socks5 server unreachable" failures.
- * - let strncpy() use the whole buffer. Using a length of 0xffu wasn't actually
- * wrong, but requires too much thinking as it doesn't depend on the buffer size.
- * - log a message if the socks5 server sends more data than expected.
- * - add some assertions and comments.
- *
- * Revision 1.24 2008/02/04 14:56:29 fabiankeil
- * - Fix a compiler warning.
- * - Stop assuming that htonl(INADDR_NONE) equals INADDR_NONE.
- *
- * Revision 1.23 2008/02/04 13:11:35 fabiankeil
- * Remember the cause of the SOCKS5 error for the CGI message.
- *
- * Revision 1.22 2008/02/03 13:46:15 fabiankeil
- * Add SOCKS5 support. Patch #1862863 by Eric M. Hopper with minor changes.
- *
- * Revision 1.21 2007/07/28 12:30:03 fabiankeil
- * Modified patch from Song Weijia (#1762559) to
- * fix socks requests on big-endian platforms.
- *
- * Revision 1.20 2007/05/14 10:23:48 fabiankeil
- * - Use strlcpy() instead of strcpy().
- * - Use the same buffer for socks requests and socks responses.
- * - Fix bogus warning about web_server_addr being used uninitialized.
- *
- * Revision 1.19 2007/01/25 14:09:45 fabiankeil
- * - Save errors in socks4_connect() to csp->error_message.
- * - Silence some gcc43 warnings, hopefully the right way.
- *
- * Revision 1.18 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.16 2002/05/12 21:36:29 jongfoster
- * Correcting function comments
- *
- * Revision 1.15 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.14 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.13 2002/03/13 00:29:59 jongfoster
- * Killing warnings
- *
- * Revision 1.12 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.11 2002/03/08 17:46:04 jongfoster
- * Fixing int/size_t warnings
- *
- * Revision 1.10 2002/03/07 03:50:19 oes
- * - Improved handling of failed DNS lookups
- * - Fixed compiler warnings
- *
- * Revision 1.9 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.8 2001/09/13 20:10:12 jongfoster
- * Fixing missing #include under Windows
- *
- * Revision 1.7 2001/09/12 17:58:26 steudten
- *
- * add #include <string.h>
- *
- * Revision 1.6 2001/09/10 10:41:16 oes
- * Added #include in.h
- *
- * Revision 1.5 2001/07/29 18:47:57 jongfoster
- * Adding missing #include project.h
- *
- * Revision 1.4 2001/07/24 12:47:06 oes
- * Applied BeOS support update by Eugenia
- *
- * Revision 1.3 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.2 2001/06/07 23:11:38 jongfoster
- * Removing gateways[] list - no longer used.
- * Replacing function pointer in struct gateway with a directly
- * called function forwarded_connect(), which can do the common
- * task of deciding whether to connect to the web server or HTTP
- * proxy.
- * Replacing struct gateway with struct forward_spec
- * Fixing bug with SOCKS4A and HTTP proxy server in combination.
- * It was a bug which led to the connection being made to the web
- * server rather than the HTTP proxy, and also a buffer overrun.
- *
- * Revision 1.1.1.1 2001/05/15 13:58:54 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef GATEWAY_H_INCLUDED
#define GATEWAY_H_INCLUDED
-#define GATEWAY_H_VERSION "$Id: gateway.h,v 1.14 2009/05/13 18:20:54 fabiankeil Exp $"
+#define GATEWAY_H_VERSION "$Id: gateway.h,v 1.15 2009/05/13 18:22:45 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/gateway.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: gateway.h,v $
- * Revision 1.14 2009/05/13 18:20:54 fabiankeil
- * There's no reason for keep_alive_timeout to be signed.
- *
- * Revision 1.13 2009/05/10 10:12:30 fabiankeil
- * Initial keep-alive support for the client socket.
- * Temporarily disable the server-side-only keep-alive code.
- *
- * Revision 1.12 2008/12/24 17:06:19 fabiankeil
- * Keep a thread around to timeout alive connections
- * even if no new requests are coming in.
- *
- * Revision 1.11 2008/11/13 09:08:42 fabiankeil
- * Add new config option: keep-alive-timeout.
- *
- * Revision 1.10 2008/10/09 18:21:41 fabiankeil
- * Flush work-in-progress changes to keep outgoing connections
- * alive where possible. Incomplete and mostly #ifdef'd out.
- *
- * Revision 1.9 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.7 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.6 2002/03/25 22:12:45 oes
- * Added fix for undefined INADDR_NONE on Solaris by Bart Schelstraete
- *
- * Revision 1.5 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.4 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.3 2001/07/29 18:58:15 jongfoster
- * Removing nested #includes, adding forward declarations for needed
- * structures, and changing the #define _FILENAME_H to FILENAME_H_INCLUDED.
- *
- * Revision 1.2 2001/06/07 23:12:14 jongfoster
- * Removing gateways[] list - no longer used.
- * Replacing function pointer in struct gateway with a directly
- * called function forwarded_connect(), which can do the common
- * task of deciding whether to connect to the web server or HTTP
- * proxy.
- * Replacing struct gateway with struct forward_spec
- *
- * Revision 1.1.1.1 2001/05/15 13:58:54 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.54 2009/04/17 11:45:19 fabiankeil Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.55 2009/05/10 10:12:30 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jbsockets.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: jbsockets.c,v $
- * Revision 1.54 2009/04/17 11:45:19 fabiankeil
- * Replace HAVE_GETADDRINFO and HAVE_GETNAMEINFO macros
- * with HAVE_RFC2553 macro. Original patch by Petr Pisar.
- *
- * Revision 1.53 2009/04/17 11:39:52 fabiankeil
- * If the hostname is 'localhost' or not specified, request an AF_INET address.
- *
- * Revision 1.52 2009/04/17 11:34:34 fabiankeil
- * Style cosmetics for the IPv6 code.
- *
- * Revision 1.51 2009/04/17 11:27:49 fabiankeil
- * Petr Pisar's privoxy-3.0.12-ipv6-3.diff.
- *
- * Revision 1.50 2008/12/20 14:53:55 fabiankeil
- * Add config option socket-timeout to control the time
- * Privoxy waits for data to arrive on a socket. Useful
- * in case of stale ssh tunnels or when fuzz-testing.
- *
- * Revision 1.49 2008/11/10 17:03:57 fabiankeil
- * Fix a gcc44 warning and remove a now-obsolete cast.
- *
- * Revision 1.48 2008/09/04 08:13:58 fabiankeil
- * Prepare for critical sections on Windows by adding a
- * layer of indirection before the pthread mutex functions.
- *
- * Revision 1.47 2008/03/26 18:07:07 fabiankeil
- * Add hostname directive. Closes PR#1918189.
- *
- * Revision 1.46 2008/03/21 11:13:57 fabiankeil
- * Only gather host information if it's actually needed.
- * Also move the code out of accept_connection() so it's less likely
- * to delay other incoming connections if the host is misconfigured.
- *
- * Revision 1.45 2007/09/30 16:59:22 fabiankeil
- * Set the maximum listen() backlog to 128. Apparently SOMAXCONN is
- * neither high enough, nor a hard limit on mingw32. Again for BR#1795281.
- *
- * Revision 1.44 2007/09/15 13:01:31 fabiankeil
- * Increase listen() backlog to SOMAXCONN (or 128) to decrease
- * chances of dropped connections under load. Problem reported
- * and fix suggested by nobody in BR#1795281.
- *
- * Revision 1.43 2007/06/01 18:16:36 fabiankeil
- * Use the same mutex for gethostbyname() and gethostbyaddr() to prevent
- * deadlocks and crashes on OpenBSD and possibly other OS with neither
- * gethostbyname_r() nor gethostaddr_r(). Closes BR#1729174.
- * Thanks to Ralf Horstmann for report and solution.
- *
- * Revision 1.42 2007/04/01 17:37:07 fabiankeil
- * - Add DNS retries for Solaris and other systems
- * whose gethostbyname_r version takes five arguments.
- * - Move maximum number of DNS retries into a macro.
- *
- * Revision 1.41 2006/11/13 19:05:51 fabiankeil
- * Make pthread mutex locking more generic. Instead of
- * checking for OSX and OpenBSD, check for FEATURE_PTHREAD
- * and use mutex locking unless there is an _r function
- * available. Better safe than sorry.
- *
- * Fixes "./configure --disable-pthread" and should result
- * in less threading-related problems on pthread-using platforms,
- * but it still doesn't fix BR#1122404.
- *
- * Revision 1.40 2006/09/02 15:36:42 fabiankeil
- * Follow the OpenBSD port's lead and protect the resolve
- * functions on OpenBSD as well.
- *
- * Revision 1.39 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.38 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.35.2.8 2006/01/21 16:16:08 david__schmidt
- * Thanks to Edward Carrel for his patch to modernize OSX's\rpthreads support. See bug #1409623.
- *
- * Revision 1.35.2.7 2005/05/07 21:50:55 david__schmidt
- * A few memory leaks plugged (mostly on error paths)
- *
- * Revision 1.35.2.6 2003/12/17 16:34:40 oes
- * Cosmetics
- *
- * Revision 1.35.2.5 2003/04/29 11:32:54 oes
- * Don't rely on h_addr being non-NULL after gethostbyname.
- * Works around an oddness in Max OSX and closes bug #724796
- *
- * Revision 1.35.2.4 2003/04/04 12:40:20 oes
- * Made sure the errno set by bind, not close[socket] is used in
- * bind_port. Probably fixes bugs #713777, #705562.
- *
- * Revision 1.35.2.3 2003/03/07 03:41:04 david__schmidt
- * Wrapping all *_r functions (the non-_r versions of them) with mutex semaphores for OSX. Hopefully this will take care of all of those pesky crash reports.
- *
- * Revision 1.35.2.2 2002/11/20 14:37:24 oes
- * Fixed Win32 error logging in bind_port.
- * Thanks to Oliver Stoeneberg for the hint.
- *
- * Revision 1.35.2.1 2002/05/26 23:41:27 joergs
- * AmigaOS: Fixed wrong type of len in write_socket()
- *
- * Revision 1.35 2002/04/26 15:50:04 joergs
- * AmigaOS: No socklen_t, added AMIGA to the systems using int instead.
- *
- * Revision 1.34 2002/04/08 20:31:41 swa
- * fixed JB spelling
- *
- * Revision 1.33 2002/04/03 16:02:18 gliptak
- * Correcting compile warning with older gcc
- *
- * Revision 1.32 2002/03/31 17:18:59 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.31 2002/03/29 03:33:13 david__schmidt
- * Fix Mac OSX compiler warnings
- *
- * Revision 1.30 2002/03/27 14:32:43 david__schmidt
- * More compiler warning message maintenance
- *
- * Revision 1.29 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.28 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.27 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.26 2002/03/11 22:07:02 david__schmidt
- * OS/2 port maintenance:
- * - Fixed EMX build - it had decayed a little
- * - Fixed inexplicable crash during FD_ZERO - must be due to a bad macro.
- * substituted a memset for now.
- *
- * Revision 1.25 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.24 2002/03/07 03:51:36 oes
- * - Improved handling of failed DNS lookups
- * - Fixed compiler warnings etc
- *
- * Revision 1.23 2002/03/05 00:36:01 jongfoster
- * Fixing bug 514988 - unable to restart Junkbuster
- *
- * Revision 1.22 2002/03/04 02:08:02 david__schmidt
- * Enable web editing of actions file on OS/2 (it had been broken all this time!)
- *
- * Revision 1.21 2002/01/09 14:32:33 oes
- * Added support for gethostbyname_r and gethostbyaddr_r.
- *
- * Revision 1.20 2001/11/16 00:48:48 jongfoster
- * Enabling duplicate-socket detection for all platforms, not
- * just Win32.
- *
- * Revision 1.19 2001/10/25 03:40:47 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.18 2001/09/21 23:02:02 david__schmidt
- * Cleaning up 2 compiler warnings on OS/2.
- *
- * Revision 1.17 2001/09/13 20:11:46 jongfoster
- * Fixing 2 compiler warnings under Win32
- *
- * Revision 1.16 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.15 2001/07/29 17:40:43 jongfoster
- * Fixed compiler warning by adding a cast
- *
- * Revision 1.14 2001/07/18 13:47:59 oes
- * Eliminated dirty hack for getsockbyname()
- *
- * Revision 1.13 2001/07/15 13:56:57 jongfoster
- * Removing unused local variable.
- *
- * Revision 1.12 2001/07/01 17:04:11 oes
- * Bugfix: accept_connection no longer uses the obsolete hstrerror() function
- *
- * Revision 1.11 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.10 2001/06/29 13:29:15 oes
- * - Added remote (server) host IP to csp->http->host_ip_addr_str
- * - Added detection of local socket IP and fqdn
- * - Removed logentry from cancelled commit
- *
- * Revision 1.9 2001/06/07 23:06:09 jongfoster
- * The host parameter to connect_to() is now const.
- *
- * Revision 1.8 2001/06/03 19:12:07 oes
- * filled comment
- *
- * Revision 1.7 2001/05/28 16:14:00 jongfoster
- * Fixing bug in LOG_LEVEL_LOG
- *
- * Revision 1.6 2001/05/26 17:28:32 jongfoster
- * Fixed LOG_LEVEL_LOG
- *
- * Revision 1.5 2001/05/26 15:26:15 jongfoster
- * ACL feature now provides more security by immediately dropping
- * connections from untrusted hosts.
- *
- * Revision 1.4 2001/05/26 00:37:42 jongfoster
- * Cosmetic indentation correction.
- *
- * Revision 1.3 2001/05/25 21:57:54 jongfoster
- * Now gives a warning under Windows if you try to bind
- * it to a port that's already in use.
- *
- * Revision 1.2 2001/05/17 23:01:01 oes
- * - Cleaned CRLF's from the sources and related files
- *
- * Revision 1.1.1.1 2001/05/15 13:58:54 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef JBSOCKETS_H_INCLUDED
#define JBSOCKETS_H_INCLUDED
-#define JBSOCKETS_H_VERSION "$Id: jbsockets.h,v 1.14 2008/12/20 14:53:55 fabiankeil Exp $"
+#define JBSOCKETS_H_VERSION "$Id: jbsockets.h,v 1.15 2009/05/10 10:12:30 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jbsockets.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: jbsockets.h,v $
- * Revision 1.14 2008/12/20 14:53:55 fabiankeil
- * Add config option socket-timeout to control the time
- * Privoxy waits for data to arrive on a socket. Useful
- * in case of stale ssh tunnels or when fuzz-testing.
- *
- * Revision 1.13 2008/03/21 11:13:59 fabiankeil
- * Only gather host information if it's actually needed.
- * Also move the code out of accept_connection() so it's less likely
- * to delay other incoming connections if the host is misconfigured.
- *
- * Revision 1.12 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.9.2.1 2002/05/26 23:41:27 joergs
- * AmigaOS: Fixed wrong type of len in write_socket()
- *
- * Revision 1.9 2002/04/08 20:31:41 swa
- * fixed JB spelling
- *
- * Revision 1.8 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.7 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.6 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.5 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.4 2002/03/07 03:51:36 oes
- * - Improved handling of failed DNS lookups
- * - Fixed compiler warnings etc
- *
- * Revision 1.3 2001/07/29 19:01:11 jongfoster
- * Changed _FILENAME_H to FILENAME_H_INCLUDED.
- * Added forward declarations for needed structures.
- *
- * Revision 1.2 2001/06/07 23:06:09 jongfoster
- * The host parameter to connect_to() is now const.
- *
- * Revision 1.1.1.1 2001/05/15 13:58:54 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "project.h"
-const char jcc_rcs[] = "$Id: jcc.c,v 1.248 2009/05/10 10:25:19 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.249 2009/05/13 18:22:45 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: jcc.c,v $
- * Revision 1.248 2009/05/10 10:25:19 fabiankeil
- * Change wait_for_alive_connection() prototype to use (void).
- *
- * Revision 1.247 2009/05/10 10:19:23 fabiankeil
- * Reenable server-side-only keep-alive support, but only share
- * outgoing connections if the connection-sharing option is set.
- *
- * Revision 1.246 2009/05/10 10:12:30 fabiankeil
- * Initial keep-alive support for the client socket.
- * Temporarily disable the server-side-only keep-alive code.
- *
- * Revision 1.245 2009/04/24 15:29:43 fabiankeil
- * Allow to limit the number of of client connections.
- *
- * Revision 1.244 2009/04/17 11:34:34 fabiankeil
- * Style cosmetics for the IPv6 code.
- *
- * Revision 1.243 2009/04/17 11:27:49 fabiankeil
- * Petr Pisar's privoxy-3.0.12-ipv6-3.diff.
- *
- * Revision 1.242 2009/04/11 10:44:47 fabiankeil
- * Update a comment. We're not in Kansas anymore.
- *
- * Revision 1.241 2009/04/11 10:37:23 fabiankeil
- * When dropping connections due to ACL, don't leak csp->ip_addr_str.
- *
- * Revision 1.240 2009/04/09 10:12:54 fabiankeil
- * Fix two cases in which an invalid server response would result
- * in the client connection being closed without sending an error
- * message first.
- *
- * Revision 1.239 2009/04/07 11:43:50 fabiankeil
- * If the server rudely resets the connection directly after sending the
- * headers, pass the mess to the client instead of sending an incorrect
- * connect-failed message. Fixes #2698674 reported by mybugaccount.
- *
- * Revision 1.238 2009/03/27 14:42:30 fabiankeil
- * Correct the status code for CONNECTION_TIMEOUT_RESPONSE.
- *
- * Revision 1.237 2009/03/27 14:32:04 fabiankeil
- * If spawning a child in listen_loop() fails, send a real
- * HTTP response to the client and continue listening for
- * new connections without artificial delay.
- *
- * Revision 1.236 2009/03/25 17:30:24 fabiankeil
- * In serve(), keep the client socket open until we marked the
- * server socket as unused. This should increase the chances
- * that we reuse the connection for the client's next request
- * to the same destination.
- *
- * Revision 1.235 2009/03/18 21:01:20 fabiankeil
- * Comment fix. Spotted by Roland.
- *
- * Revision 1.234 2009/03/18 20:48:42 fabiankeil
- * If the --no-daemon option is used, enable LOG_LEVEL_INFO
- * before the config file has been parsed (as we always did).
- *
- * Revision 1.233 2009/03/13 14:10:07 fabiankeil
- * Fix some more harmless warnings on amd64.
- *
- * Revision 1.232 2009/03/08 19:29:16 fabiankeil
- * Reinitialize the timeout structure every time before passing
- * it to select(). Apparently some implementations mess with it.
- * Probably fixes #2669131 reported by cyberpatrol.
- *
- * Revision 1.231 2009/03/08 14:19:23 fabiankeil
- * Fix justified (but harmless) compiler warnings
- * on platforms where sizeof(int) < sizeof(long).
- *
- * Revision 1.230 2009/03/07 13:09:17 fabiankeil
- * Change csp->expected_content and_csp->expected_content_length from
- * size_t to unsigned long long to reduce the likelihood of integer
- * overflows that would let us close the connection prematurely.
- * Bug found while investigating #2669131, reported by cyberpatrol.
- *
- * Revision 1.229 2009/03/07 11:17:01 fabiankeil
- * Fix compiler warning.
- *
- * Revision 1.228 2009/03/06 20:30:13 fabiankeil
- * Log unsigned values as such.
- *
- * Revision 1.227 2009/03/02 19:18:11 fabiankeil
- * Streamline parse_http_request()'s prototype. As
- * cparser pointed out it doesn't actually use csp.
- *
- * Revision 1.226 2009/03/01 18:28:24 fabiankeil
- * Help clang understand that we aren't dereferencing
- * NULL pointers here.
- *
- * Revision 1.225 2009/02/19 18:09:32 fabiankeil
- * Unbreak build without FEATURE_CONNECTION_KEEP_ALIVE.
- * Noticed by David.
- *
- * Revision 1.224 2009/02/14 15:32:04 fabiankeil
- * Add the request URL to the timeout message in chat().
- * Suggested by Lee.
- *
- * Revision 1.223 2009/02/09 21:21:16 fabiankeil
- * Now that init_log_module() is called earlier, call show_version()
- * later on from main() directly so it doesn't get called for --help
- * or --version.
- *
- * Revision 1.222 2009/02/08 12:56:51 fabiankeil
- * Call initialize_mutexes() before init_log_module() again.
- * Broken since r220, might be the cause of Lee's #2579448.
- *
- * Revision 1.221 2009/02/06 18:02:58 fabiankeil
- * When dropping privileges, also give up membership in supplementary
- * groups. Thanks to Matthias Drochner for reporting the problem,
- * providing the initial patch and testing the final version.
- *
- * Revision 1.220 2009/02/04 18:29:07 fabiankeil
- * Initialize the log module before parsing arguments.
- * Thanks to Matthias Drochner for the report.
- *
- * Revision 1.219 2009/01/31 16:08:21 fabiankeil
- * Remove redundant error check in receive_client_request().
- *
- * Revision 1.218 2009/01/31 12:25:54 fabiankeil
- * Flatten indentation in receive_client_request().
- *
- * Revision 1.217 2009/01/07 19:50:09 fabiankeil
- * - If the socket-timeout has been reached and the client
- * hasn't received any data yet, send an explanation before
- * closing the connection.
- * - In get_request_line(), signal timeouts the right way.
- *
- * Revision 1.216 2008/12/24 22:13:11 ler762
- * fix GCC 3.4.4 warning
- *
- * Revision 1.215 2008/12/24 17:06:19 fabiankeil
- * Keep a thread around to timeout alive connections
- * even if no new requests are coming in.
- *
- * Revision 1.214 2008/12/20 14:53:55 fabiankeil
- * Add config option socket-timeout to control the time
- * Privoxy waits for data to arrive on a socket. Useful
- * in case of stale ssh tunnels or when fuzz-testing.
- *
- * Revision 1.213 2008/12/15 18:45:51 fabiankeil
- * When logging crunches, log the whole URL, so one can easily
- * differentiate between vanilla HTTP and CONNECT requests.
- *
- * Revision 1.212 2008/12/14 15:46:22 fabiankeil
- * Give crunched requests their own log level.
- *
- * Revision 1.211 2008/12/06 10:05:03 fabiankeil
- * Downgrade "Received x bytes while expecting y." message to
- * LOG_LEVEL_CONNECT as it doesn't necessarily indicate an error.
- *
- * Revision 1.210 2008/12/02 22:03:18 fabiankeil
- * Don't miscalculate byte_count if we don't get all the
- * server headers with one read_socket() call. With keep-alive
- * support enabled, this caused delays until the server closed
- * the connection.
- *
- * Revision 1.209 2008/11/27 09:44:04 fabiankeil
- * Cosmetics for the last commit: Don't watch out for
- * the last chunk if the content isn't chunk-encoded or
- * if we already determined the content length previously.
- *
- * Revision 1.208 2008/11/26 18:24:17 fabiankeil
- * Recognize that the server response is complete if the
- * last chunk is read together with the server headers.
- * Reported by Lee.
- *
- * Revision 1.207 2008/11/25 17:25:16 fabiankeil
- * Don't convert the client-header list to text until we need to.
- *
- * Revision 1.206 2008/11/23 17:00:11 fabiankeil
- * Some more chat() cosmetics.
- *
- * Revision 1.205 2008/11/16 12:43:49 fabiankeil
- * Turn keep-alive support into a runtime feature
- * that is disabled by setting keep-alive-timeout
- * to a negative value.
- *
- * Revision 1.204 2008/11/06 19:42:17 fabiankeil
- * Fix last-chunk detection hack to also apply
- * if buf[] contains nothing but the last-chunk.
- *
- * Revision 1.203 2008/11/06 18:34:35 fabiankeil
- * Factor receive_client_request() and
- * parse_client_request() out of chat().
- *
- * Revision 1.202 2008/11/02 18:40:34 fabiankeil
- * If we received a different amount of data than we expected,
- * log a warning and make sure the server socket isn't reused.
- *
- * Revision 1.201 2008/11/02 16:48:20 fabiankeil
- * Revert revision 1.195 and try again.
- *
- * Revision 1.200 2008/10/26 16:53:18 fabiankeil
- * Fix gcc44 warning.
- *
- * Revision 1.199 2008/10/26 15:36:10 fabiankeil
- * Remove two debug messages with LOG_LEVEL_INFO.
- *
- * Revision 1.198 2008/10/22 15:19:55 fabiankeil
- * Once More, With Feeling: if there is no logfile
- * because the user didn't specify one, we shouldn't
- * call init_error_log() after receiving SIGHUP either.
- *
- * Revision 1.197 2008/10/20 17:02:40 fabiankeil
- * If SIGHUP is received while we aren't running in daemon
- * mode, calling init_error_log() would be a mistake.
- *
- * Revision 1.196 2008/10/16 09:16:41 fabiankeil
- * - Fix two gcc44 conversion warnings.
- * - Don't bother logging the last five bytes
- * of the 0-chunk.
- *
- * Revision 1.195 2008/10/13 16:04:37 fabiankeil
- * Make sure we don't try to reuse tainted server sockets.
- *
- * Revision 1.194 2008/10/12 18:35:18 fabiankeil
- * The last commit was a bit too ambitious, apparently the content
- * length adjustment is only necessary if we aren't buffering.
- *
- * Revision 1.193 2008/10/12 15:57:35 fabiankeil
- * Fix content length calculation if we read headers
- * and the start of the body at once. Now that we have
- * FEATURE_CONNECTION_KEEP_ALIVE, it actually matters.
- *
- * Revision 1.192 2008/10/11 18:19:14 fabiankeil
- * Even more chat() cosmetics.
- *
- * Revision 1.191 2008/10/11 18:00:14 fabiankeil
- * Reformat some comments in chat().
- *
- * Revision 1.190 2008/10/11 14:58:00 fabiankeil
- * In case of chunk-encoded content, stop reading if
- * the buffer looks like it ends with the last chunk.
- *
- * Revision 1.189 2008/10/11 09:53:00 fabiankeil
- * Let server_response_is_complete() deal properly with
- * content that is neither buffered nor read all at once.
- *
- * Revision 1.188 2008/10/09 18:21:41 fabiankeil
- * Flush work-in-progress changes to keep outgoing connections
- * alive where possible. Incomplete and mostly #ifdef'd out.
- *
- * Revision 1.187 2008/09/07 12:35:05 fabiankeil
- * Add mutex lock support for _WIN32.
- *
- * Revision 1.186 2008/09/04 08:13:58 fabiankeil
- * Prepare for critical sections on Windows by adding a
- * layer of indirection before the pthread mutex functions.
- *
- * Revision 1.185 2008/08/30 12:03:07 fabiankeil
- * Remove FEATURE_COOKIE_JAR.
- *
- * Revision 1.184 2008/08/22 15:34:45 fabiankeil
- * - Silence LLVM/Clang complaint.
- * - Make received_hup_signal static.
- * - Hide definitions for basedir, pidfile and received_hup_signal
- * from __EMX__ as they only seem to be used in case of #ifdef unix.
- *
- * Revision 1.183 2008/08/21 07:09:35 fabiankeil
- * Accept Shoutcast responses again. Problem reported
- * and fix suggested by Stefan in #2062860.
- *
- * Revision 1.182 2008/06/27 11:13:56 fabiankeil
- * Fix possible NULL-pointer dereference reported
- * by din_a4 in #2003937. Pointy hat to me.
- *
- * Revision 1.181 2008/05/21 15:47:15 fabiankeil
- * Streamline sed()'s prototype and declare
- * the header parse and add structures static.
- *
- * Revision 1.180 2008/05/21 15:26:32 fabiankeil
- * - Mark csp as immutable for send_crunch_response().
- * - Fix comment spelling.
- *
- * Revision 1.179 2008/05/20 20:13:32 fabiankeil
- * Factor update_server_headers() out of sed(), ditch the
- * first_run hack and make server_patterns_light static.
- *
- * Revision 1.178 2008/05/10 13:23:38 fabiankeil
- * Don't provide get_header() with the whole client state
- * structure when it only needs access to csp->iob.
- *
- * Revision 1.177 2008/05/10 11:51:12 fabiankeil
- * Make the "read the rest of the headers" loop a bit more readable.
- *
- * Revision 1.176 2008/05/10 11:37:57 fabiankeil
- * - Instead of logging when the IIS5 hack is enabled, log when it fails.
- * - Remove useless comment.
- *
- * Revision 1.175 2008/05/09 18:53:59 fabiankeil
- * Fix comment grammar.
- *
- * Revision 1.174 2008/05/07 18:05:53 fabiankeil
- * Remove the pointless buffer in client_protocol_is_unsupported().
- *
- * Revision 1.173 2008/05/06 15:09:00 fabiankeil
- * Least-effort fix for bug #1821930 (reported by Lee):
- * If the response doesn't look like HTTP,
- * tell the client and log the problem.
- *
- * Revision 1.172 2008/04/16 16:38:21 fabiankeil
- * Don't pass the whole csp structure to flush_socket()
- * when it only needs a file descriptor and a buffer.
- *
- * Revision 1.171 2008/03/27 18:27:25 fabiankeil
- * Remove kill-popups action.
- *
- * Revision 1.170 2008/03/06 16:33:46 fabiankeil
- * If limit-connect isn't used, don't limit CONNECT requests to port 443.
- *
- * Revision 1.169 2008/03/04 18:30:39 fabiankeil
- * Remove the treat-forbidden-connects-like-blocks action. We now
- * use the "blocked" page for forbidden CONNECT requests by default.
- *
- * Revision 1.168 2008/03/02 12:25:25 fabiankeil
- * Also use shiny new connect_port_is_forbidden() in jcc.c.
- *
- * Revision 1.167 2008/02/23 16:57:12 fabiankeil
- * Rename url_actions() to get_url_actions() and let it
- * use the standard parameter ordering.
- *
- * Revision 1.166 2008/02/23 16:33:43 fabiankeil
- * Let forward_url() use the standard parameter ordering
- * and mark its second parameter immutable.
- *
- * Revision 1.165 2008/02/02 19:36:56 fabiankeil
- * Remove the "Listening ... for local connections only" log message.
- * Whether or not remote connections are able to reach Privoxy is up
- * to the operating system.
- *
- * Revision 1.164 2007/12/16 18:32:46 fabiankeil
- * Prevent the log messages for CONNECT requests to unacceptable
- * ports from printing the limit-connect argument as [null] if
- * limit-connect hasn't been explicitly enabled.
- *
- * Revision 1.163 2007/12/13 01:47:11 david__schmidt
- * Make sure all console-mode apps get a usage() instance
- *
- * Revision 1.162 2007/12/06 17:54:57 fabiankeil
- * Reword NO_SERVER_DATA_RESPONSE to make it harder
- * to misunderstand what the message is all about.
- *
- * Revision 1.161 2007/12/04 19:44:22 fabiankeil
- * Unbreak trustfile which previously didn't work without
- * FEATURE_TOGGLE. Fixes BR#1843585, reported by Lee.
- *
- * Revision 1.160 2007/11/29 18:00:29 fabiankeil
- * Plug memory leak. Spotted by Valgrind, triggered by
- * Privoxy-Regression-Test feeding proxyfuzz.py.
- *
- * Revision 1.159 2007/11/24 14:34:09 fabiankeil
- * In the HTTP snipplets, refer to the client as client.
- *
- * Revision 1.158 2007/11/11 16:44:17 fabiankeil
- * Emit a log message when activating the MS IIS5 hack.
- *
- * Revision 1.157 2007/11/03 17:34:49 fabiankeil
- * Log the "weak randomization factor" warning only
- * once for mingw32 and provide some more details.
- *
- * Revision 1.156 2007/11/01 18:20:58 fabiankeil
- * Initialize log module after initializing mutexes, future
- * deadlocks in that code should now work cross-platform.
- *
- * Revision 1.155 2007/10/23 20:12:45 fabiankeil
- * Fix first CSUCCEED line to end in \r\n as required by RFC1945.
- * Reported by Bert van Leeuwen in BR#1818808.
- *
- * Revision 1.154 2007/10/19 17:00:08 fabiankeil
- * Downgrade "Flushing header and buffers" message to LOG_LEVEL_INFO.
- *
- * Revision 1.153 2007/10/14 14:12:41 fabiankeil
- * When in daemon mode, close stderr after the configuration file has been
- * parsed the first time. If logfile isn't set, stop logging. Fixes BR#897436.
- *
- * Revision 1.152 2007/10/04 18:03:34 fabiankeil
- * - Fix a crash when parsing invalid requests whose first header
- * is rejected by get_header(). Regression (re?)introduced
- * in r1.143 by yours truly.
- * - Move ACTION_VANILLA_WAFER handling into parsers.c's
- * client_cookie_adder() to make sure send-vanilla-wafer can be
- * controlled through tags (and thus regression-tested).
- *
- * Revision 1.151 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.150 2007/09/28 16:39:29 fabiankeil
- * Execute content filters through execute_content_filter().
- *
- * Revision 1.149 2007/09/04 15:08:48 fabiankeil
- * Initialize req to NULL to make sure it's defined if the
- * first read_socket() call fails. Reported by icmp30.
- *
- * Revision 1.148 2007/08/26 16:47:13 fabiankeil
- * Add Stephen Gildea's --pre-chroot-nslookup patch [#1276666],
- * extensive comments moved to user manual.
- *
- * Revision 1.147 2007/08/25 14:42:40 fabiankeil
- * Don't crash if a broken header filter wiped out the request line.
- *
- * Revision 1.146 2007/08/20 17:09:32 fabiankeil
- * Fix byte_count calculation in case of flushes
- * and don't parse the server headers a second time.
- *
- * Revision 1.145 2007/08/19 13:13:31 fabiankeil
- * - If there's a connection problem after we already forwarded
- * parts of the original content, just hang up. Fixes BR#1776724.
- * - Fix warnings about unused code on mingw32.
- * - In case of flushes, calculate the byte count
- * less incorrectly (I think).
- *
- * Revision 1.144 2007/08/11 14:43:22 fabiankeil
- * Add some more prototypes for static functions.
- *
- * Revision 1.143 2007/08/05 13:58:19 fabiankeil
- * Comment out request_contains_null_bytes() until it's used again.
- *
- * Revision 1.142 2007/08/05 13:50:26 fabiankeil
- * #1763173 from Stefan Huehner: s@const static@static const@
- * and declare some more functions static.
- *
- * Revision 1.141 2007/08/04 09:56:23 fabiankeil
- * - Log rejected CONNECT requests with LOG_LEVEL_INFO
- * and explain why they were rejected in the first place.
- * - Fix the LOG_LEVEL_CLF message for crunches of unallowed
- * CONNECT requests. The request line was missing.
- * - Add two more XXX reminders as we don't have enough already.
- *
- * Revision 1.140 2007/07/21 11:51:36 fabiankeil
- * As Hal noticed, checking dispatch_cgi() as the last cruncher
- * looks like a bug if CGI requests are blocked unintentionally,
- * so don't do it unless the user enabled the new config option
- * "allow-cgi-request-crunching".
- *
- * Revision 1.139 2007/07/14 07:46:41 fabiankeil
- * - Allow to rewrite the request destination behind the client's back.
- * - Turn the weird-looking unconditional for loop that
- * reads the client request into a conditional while loop.
- * Move the stuff that only runs once out of the loop.
- * - Move parts of chat(), server_content_type() and the
- * necessary stuff to fix BR#1750917 into get_filter_function().
- *
- * Revision 1.138 2007/06/03 18:45:18 fabiankeil
- * Temporary workaround for BR#1730105.
- *
- * Revision 1.137 2007/06/01 18:16:36 fabiankeil
- * Use the same mutex for gethostbyname() and gethostbyaddr() to prevent
- * deadlocks and crashes on OpenBSD and possibly other OS with neither
- * gethostbyname_r() nor gethostaddr_r(). Closes BR#1729174.
- * Thanks to Ralf Horstmann for report and solution.
- *
- * Revision 1.136 2007/06/01 16:41:11 fabiankeil
- * Add forward-override{} to change the forwarding settings through
- * action sections. This is mainly interesting to forward different
- * clients differently (for example based on User-Agent or request
- * origin).
- *
- * Revision 1.135 2007/05/24 17:03:50 fabiankeil
- * - Let usage() mention the --chroot parameter.
- * - Use read_socket() consistently and always leave
- * the last buffer byte alone, even in cases where
- * null termination (currently) doesn't matter.
- *
- * Revision 1.134 2007/05/16 14:59:46 fabiankeil
- * - Fix config file loading on Unix if no config file is specified.
- * Since r1.97 Privoxy would always interpret the last argument as
- * config file, even if it's a valid command line option.
- * - Abort in case of unrecognized command line options. Closes #1719696.
- * - Remove a bunch of unnecessary strcpy() calls (yay for c&p without thinking).
- * - Replace the remaining strcpy() and strcat() calls with strlcpy() and strcat().
- *
- * Revision 1.133 2007/05/04 11:23:19 fabiankeil
- * - Don't rerun crunchers that only depend on the request URL.
- * - Don't count redirects and CGI requests as "blocked requests".
- *
- * Revision 1.132 2007/04/25 15:15:17 fabiankeil
- * Support crunching based on tags created by server-header taggers.
- *
- * Revision 1.131 2007/04/22 13:24:50 fabiankeil
- * Make HTTP snippets static (again). Add a Content-Type for those
- * with content so the browser doesn't guess it based on the URL.
- *
- * Revision 1.130 2007/04/19 13:47:34 fabiankeil
- * Move crunching and request line rebuilding out of chat().
- *
- * Revision 1.129 2007/04/15 16:39:20 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.128 2007/03/25 16:55:54 fabiankeil
- * Don't CLF-log CONNECT requests twice.
- *
- * Revision 1.127 2007/03/20 13:53:17 fabiankeil
- * Log the source address for ACL-related connection drops.
- *
- * Revision 1.126 2007/03/17 15:20:05 fabiankeil
- * New config option: enforce-blocks.
- *
- * Revision 1.125 2007/03/09 14:12:00 fabiankeil
- * - Move null byte check into separate function.
- * - Don't confuse the client with error pages
- * if a CONNECT request was already confirmed.
- *
- * Revision 1.124 2007/02/23 14:59:54 fabiankeil
- * Speed up NULL byte escaping and only log the complete
- * NULL byte requests with header debugging enabled.
- *
- * Revision 1.123 2007/02/21 18:42:10 fabiankeil
- * Answer requests that contain NULL bytes with
- * a custom response instead of waiting for more
- * data until the client eventually hangs up.
- *
- * Revision 1.122 2007/02/07 11:12:02 fabiankeil
- * - Move delivery and logging of crunched responses
- * from chat() into send_crunch_response().
- * - Display the reason for generating http_responses.
- * - Log the content length for LOG_LEVEL_CLF correctly
- * (still incorrect for some fixed responses).
- * - Reword an incorrect comment about
- * treat-forbidden-connects-like-blocks violating
- * the specs.
- * - Add some log messages.
- *
- * Revision 1.121 2007/01/27 10:52:56 fabiankeil
- * Move mutex initialization into separate
- * function and exit in case of errors.
- *
- * Revision 1.120 2007/01/26 14:18:42 fabiankeil
- * - Start to reduce chat()'s line count and move
- * parts of it into separate functions.
- * - Add "HTTP/1.1 100 Continue" hack for BR 756734.
- *
- * Revision 1.119 2007/01/25 14:02:30 fabiankeil
- * - Add Proxy-Agent header to HTTP snippets that are
- * supposed to reach HTTP clients only.
- * - Made a few CONNECT log messages more descriptive.
- * - Catch completely empty server responses (as seen
- * with Tor's fake ".noconnect" top level domain).
- * - Use shiny new "forwarding-failed" template for socks errors.
- *
- * Revision 1.118 2007/01/07 07:43:43 joergs
- * AmigaOS4 support added.
- *
- * Revision 1.117 2006/12/31 17:56:37 fabiankeil
- * Added config option accept-intercepted-requests
- * and disabled it by default.
- *
- * Revision 1.116 2006/12/29 19:08:22 fabiankeil
- * Reverted parts of my last commit
- * to keep error handling working.
- *
- * Revision 1.115 2006/12/29 17:38:57 fabiankeil
- * Fixed gcc43 conversion warnings.
- *
- * Revision 1.114 2006/12/27 18:52:02 fabiankeil
- * Fix -pedantic ISO C warning about converting
- * from function pointer to object pointer.
- *
- * Revision 1.113 2006/12/26 17:38:50 fabiankeil
- * Silence compiler warning I introduced with my last commit.
- *
- * Revision 1.112 2006/12/26 17:31:41 fabiankeil
- * Mutex protect rand() if POSIX threading
- * is used, warn the user if that's not possible
- * and stop using it on _WIN32 where it could
- * cause crashes.
- *
- * Revision 1.111 2006/12/23 16:15:06 fabiankeil
- * Don't prevent core dumps by catching SIGABRT.
- * It's rude and makes debugging unreasonable painful.
- *
- * Revision 1.110 2006/12/13 14:52:53 etresoft
- * Fix build failure on MacOS X. Global symbols can be either static or extern, but not both.
- *
- * Revision 1.109 2006/12/06 19:41:40 fabiankeil
- * Privoxy is now able to run as intercepting
- * proxy in combination with any packet filter
- * that does the port redirection. The destination
- * is extracted from the "Host:" header which
- * should be available for nearly all requests.
- *
- * Moved HTTP snipplets into jcc.c.
- * Added error message for gopher proxy requests.
- *
- * Revision 1.108 2006/11/28 15:38:51 fabiankeil
- * Only unlink the pidfile if it's actually used.
- *
- * Change order of interception checks to make
- * it possible to block or redirect requests for
- * the cgi pages.
- *
- * Revision 1.107 2006/11/13 19:05:51 fabiankeil
- * Make pthread mutex locking more generic. Instead of
- * checking for OSX and OpenBSD, check for FEATURE_PTHREAD
- * and use mutex locking unless there is an _r function
- * available. Better safe than sorry.
- *
- * Fixes "./configure --disable-pthread" and should result
- * in less threading-related problems on pthread-using platforms,
- * but it still doesn't fix BR#1122404.
- *
- * Revision 1.106 2006/11/06 19:58:23 fabiankeil
- * Move pthread.h inclusion from jcc.c to jcc.h.
- * Fixes build on x86-freebsd1 (FreeBSD 5.4-RELEASE).
- *
- * Revision 1.105 2006/11/06 14:26:02 fabiankeil
- * Don't exit after receiving the second SIGHUP on Solaris.
- *
- * Fixes BR 1052235, but the same problem may exist on other
- * systems. Once 3.0.6 is out we should use sigset()
- * where available and see if it breaks anything.
- *
- * Revision 1.104 2006/09/23 13:26:38 roro
- * Replace TABs by spaces in source code.
- *
- * Revision 1.103 2006/09/21 12:54:43 fabiankeil
- * Fix +redirect{}. Didn't work with -fast-redirects.
- *
- * Revision 1.102 2006/09/06 13:03:04 fabiankeil
- * Respond with 400 and a short text message
- * if the client tries to use Privoxy as FTP proxy.
- *
- * Revision 1.101 2006/09/06 09:23:37 fabiankeil
- * Make number of retries in case of forwarded-connect problems
- * a config file option (forwarded-connect-retries) and use 0 as
- * default.
- *
- * Revision 1.100 2006/09/03 19:42:59 fabiankeil
- * Set random(3) seed.
- *
- * Revision 1.99 2006/09/02 15:36:42 fabiankeil
- * Follow the OpenBSD port's lead and protect the resolve
- * functions on OpenBSD as well.
- *
- * Revision 1.98 2006/08/24 11:01:34 fabiankeil
- * --user fix. Only use the user as group if no group is specified.
- * Solves BR 1492612. Thanks to Spinor S. and David Laight.
- *
- * Revision 1.97 2006/08/18 15:23:17 david__schmidt
- * Windows service (re-)integration
- *
- * The new args are:
- *
- * --install[:service_name]
- * --uninstall[:service_name]
- * --service
- *
- * They work as follows:
- * --install will create a service for you and then terminate.
- * By default the service name will be "privoxy" (without the quotes).
- * However you can run multiple services if you wish, just by adding
- * a colon and then a name (no spaces).
- *
- * --uninstall follows the exact same rules a --install.
- *
- * --service is used when the program is executed by the service
- * control manager, and in normal circumstances would never be
- * used as a command line argument.
- *
- * Revision 1.96 2006/08/15 20:12:36 david__schmidt
- * Windows service integration
- *
- * Revision 1.95 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:
-http://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.94 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.92.2.16 2005/04/03 20:10:50 david__schmidt
- * Thanks to Jindrich Makovicka for a race condition fix for the log
- * file. The race condition remains for non-pthread implementations.
- * Reference patch #1175720.
- *
- * Revision 1.92.2.15 2004/10/03 12:53:32 david__schmidt
- * Add the ability to check jpeg images for invalid
- * lengths of comment blocks. Defensive strategy
- * against the exploit:
- * Microsoft Security Bulletin MS04-028
- * Buffer Overrun in JPEG Processing (GDI+) Could
- * Allow Code Execution (833987)
- * Enabled with +inspect-jpegs in actions files.
- *
- * Revision 1.92.2.14 2003/12/12 12:52:53 oes
- * - Fixed usage info for non-unix platforms
- * - Fixed small cmdline parsing bug
- *
- * Revision 1.92.2.13 2003/11/27 19:20:27 oes
- * Diagnostics: Now preserve the returncode of pthread_create
- * in errno. Closes BR #775721. Thanks to Geoffrey Hausheer.
- *
- * Revision 1.92.2.12 2003/07/11 11:34:19 oes
- * No longer ignore SIGCHLD. Fixes bug #769381
- *
- * Revision 1.92.2.11 2003/05/14 12:32:02 oes
- * Close jarfile on graceful exit, remove stray line
- *
- * Revision 1.92.2.10 2003/05/08 15:13:46 oes
- * Cosmetics: Killed a warning, a typo and an allocation left at exit
- *
- * Revision 1.92.2.9 2003/04/03 15:08:42 oes
- * No longer rely on non-POSIX.1 extensions of getcwd().
- * Fixes bug #711001
- *
- * Revision 1.92.2.8 2003/03/31 13:12:32 oes
- * Replaced setenv() by posix-compliant putenv()
- * Thanks to Neil McCalden (nmcc AT users.sf.net).
- *
- * Revision 1.92.2.7 2003/03/17 16:48:59 oes
- * Added chroot ability, thanks to patch by Sviatoslav Sviridov
- *
- * Revision 1.92.2.6 2003/03/11 11:55:00 oes
- * Clean-up and extension of improvements for forked mode:
- * - Child's return code now consists of flags RC_FLAG_*
- * - Reporting toggle to parent now properly #ifdef'ed
- * - Children now report blocking to parent. This enables
- * statistics in forked mode
- *
- * Revision 1.92.2.5 2003/03/10 23:45:32 oes
- * Fixed bug #700381: Non-Threaded version now capable of being toggled.
- * Children now report having been toggled through _exit(17), parents
- * watch for that code and toggle themselves if found.
- *
- * Revision 1.92.2.4 2003/03/07 03:41:04 david__schmidt
- * Wrapping all *_r functions (the non-_r versions of them) with
- * mutex semaphores for OSX. Hopefully this will take care of all
- * of those pesky crash reports.
- *
- * Revision 1.92.2.3 2003/02/28 12:53:06 oes
- * Fixed two mostly harmless mem leaks
- *
- * Revision 1.92.2.2 2002/11/20 14:37:47 oes
- * Fix: Head of global clients list now initialized to NULL
- *
- * Revision 1.92.2.1 2002/09/25 14:52:24 oes
- * Added basic support for OPTIONS and TRACE HTTP methods:
- * - New interceptor direct_response() added in chat().
- * - sed() moved to earlier in the process, so that the
- * Host: header is evaluated before actions and forwarding
- * are decided on.
- *
- * Revision 1.92 2002/05/08 16:00:46 oes
- * Chat's buffer handling:
- * - Fixed bug with unchecked out-of-mem conditions
- * while reading client request & server headers
- * - No longer predict if the buffer limit will be exceeded
- * in the next read -- check add_to_iob's new
- * return code. If buffer couldn't be extended
- * (policy or out-of-mem) while
- * - reading from client: abort
- * - reading server headers: send error page
- * - buffering server body for filter: flush,
- * and if that fails: send error page
- *
- * Revision 1.91 2002/04/08 20:35:58 swa
- * fixed JB spelling
- *
- * Revision 1.90 2002/04/02 14:57:28 oes
- * Made sending wafers independent of FEATURE_COOKIE_JAR
- *
- * Revision 1.89 2002/03/31 17:18:59 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.88 2002/03/27 14:32:43 david__schmidt
- * More compiler warning message maintenance
- *
- * Revision 1.87 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.86 2002/03/25 17:04:55 david__schmidt
- * Workaround for closing the jarfile before load_config() comes around again
- *
- * Revision 1.85 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.84 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.83 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.82 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.81 2002/03/12 01:42:50 oes
- * Introduced modular filters
- *
- * Revision 1.80 2002/03/11 22:07:05 david__schmidt
- * OS/2 port maintenance:
- * - Fixed EMX build - it had decayed a little
- * - Fixed inexplicable crash during FD_ZERO - must be due to a bad macro.
- * substituted a memset for now.
- *
- * Revision 1.79 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.78 2002/03/08 21:35:04 oes
- * Added optional group supplement to --user option. Will now use default group of user if no group given
- *
- * Revision 1.77 2002/03/07 03:52:06 oes
- * - Fixed compiler warnings etc
- * - Improved handling of failed DNS lookups
- *
- * Revision 1.76 2002/03/06 22:54:35 jongfoster
- * Automated function-comment nitpicking.
- *
- * Revision 1.75 2002/03/06 10:02:19 oes
- * Fixed stupid bug when --user was not given
- *
- * Revision 1.74 2002/03/06 00:49:31 jongfoster
- * Fixing warning on Windows
- * Making #ifdefs that refer to the same variable consistently
- * use #ifdef unix rather than mixing #ifdef unix & #ifndef OS2
- *
- * Revision 1.73 2002/03/05 23:57:30 hal9
- * Stray character 's' on line 1618 was breaking build.
- *
- * Revision 1.72 2002/03/05 21:33:45 david__schmidt
- * - Re-enable OS/2 building after new parms were added
- * - Fix false out of memory report when resolving CGI templates when no IP
- * address is available of failed attempt (a la no such domain)
- *
- * Revision 1.71 2002/03/05 18:13:56 oes
- * Added --user option
- *
- * Revision 1.70 2002/03/05 04:52:42 oes
- * Deleted non-errlog debugging code
- *
- * Revision 1.69 2002/03/04 23:50:00 jongfoster
- * Splitting off bind_port() call into bind_port_helper(), with
- * improved logging.
- *
- * Revision 1.68 2002/03/04 20:17:32 oes
- * Fixed usage info
- *
- * Revision 1.67 2002/03/04 18:18:57 oes
- * - Removed _DEBUG mode
- * - Cleand up cmdline parsing
- * - Introduced --no-daemon, --pidfile options
- * - Cleaned up signal handling:
- * - Terminate cleanly on INT, TERM and ABRT
- * - Schedule logfile for re-opening on HUP
- * - Ignore CHLD and PIPE
- * - Leave the rest with their default handlers
- * - Uniform handler registration
- * - Added usage() function
- * - Played styleguide police
- *
- * Revision 1.66 2002/03/03 15:06:55 oes
- * Re-enabled automatic config reloading
- *
- * Revision 1.65 2002/03/03 14:49:11 oes
- * Fixed CLF logging: Now uses client's original HTTP request
- *
- * Revision 1.64 2002/03/03 09:18:03 joergs
- * Made jumbjuster work on AmigaOS again.
- *
- * Revision 1.63 2002/03/02 04:14:50 david__schmidt
- * Clean up a little CRLF unpleasantness that suddenly appeared
- *
- * Revision 1.62 2002/02/20 23:17:23 jongfoster
- * Detecting some out-of memory conditions and exiting with a log message.
- *
- * Revision 1.61 2002/01/17 21:01:52 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Revision 1.60 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.59 2001/12/13 14:07:18 oes
- * Fixed Bug: 503 error page now sent OK
- *
- * Revision 1.58 2001/11/30 23:37:24 jongfoster
- * Renaming the Win32 config file to config.txt - this is almost the
- * same as the corresponding UNIX name "config"
- *
- * Revision 1.57 2001/11/16 00:47:43 jongfoster
- * Changing the tty-disconnection code to use setsid().
- *
- * Revision 1.56 2001/11/13 20:20:54 jongfoster
- * Tabs->spaces, fixing a bug with missing {} around an if()
- *
- * Revision 1.55 2001/11/13 20:14:53 jongfoster
- * Patch for FreeBSD setpgrp() as suggested by Alexander Lazic
- *
- * Revision 1.54 2001/11/07 00:03:14 steudten
- * Give reliable return value if an error
- * occurs not just 0 with new daemon mode.
- *
- * Revision 1.53 2001/11/05 21:41:43 steudten
- * Add changes to be a real daemon just for unix os.
- * (change cwd to /, detach from controlling tty, set
- * process group and session leader to the own process.
- * Add DBG() Macro.
- * Add some fatal-error log message for failed malloc().
- * Add '-d' if compiled with 'configure --with-debug' to
- * enable debug output.
- *
- * Revision 1.52 2001/10/26 20:11:20 jongfoster
- * Fixing type mismatch
- *
- * Revision 1.51 2001/10/26 17:38:28 oes
- * Cosmetics
- *
- * Revision 1.50 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.49 2001/10/23 21:41:35 jongfoster
- * Added call to initialize the (statically-allocated of course)
- * "out of memory" CGI response.
- *
- * Revision 1.48 2001/10/10 19:56:46 jongfoster
- * Moving some code that wasn't cookie-related out of an #ifdef
- * FEATURE_COOKIE_JAR
- *
- * Revision 1.47 2001/10/10 16:44:36 oes
- * Added CONNECT destination port limitation check
- *
- * Revision 1.46 2001/10/08 15:17:41 oes
- * Re-enabled SSL forwarding
- *
- * Revision 1.45 2001/10/07 15:42:11 oes
- * Replaced 6 boolean members of csp with one bitmap (csp->flags)
- *
- * Moved downgrading of the HTTP version from parse_http_request to
- * chat(), since we can't decide if it is necessary before we have
- * determined the actions for the URL. The HTTP command is now
- * *always* re-built so the repairs need no longer be special-cased.
- *
- * filter_popups now gets a csp pointer so it can raise the new
- * CSP_FLAG_MODIFIED flag.
- *
- * Bugfix
- *
- * Added configurable size limit for the IOB. If the IOB grows so
- * large that the next read would exceed the limit, the header
- * is generated, and the header & unfiltered buffer are flushed
- * to the client. Chat then continues in non-buffering,
- * non-filtering body mode.
- *
- * Revision 1.44 2001/10/02 18:13:57 oes
- * Ooops
- *
- * Revision 1.43 2001/10/02 15:32:13 oes
- * Moved generation of hdr
- *
- * Revision 1.42 2001/09/21 23:02:02 david__schmidt
- * Cleaning up 2 compiler warnings on OS/2.
- *
- * Revision 1.41 2001/09/16 17:05:14 jongfoster
- * Removing unused #include showarg.h
- *
- * Revision 1.40 2001/09/16 15:41:45 jongfoster
- * Fixing signed/unsigned comparison warning.
- *
- * Revision 1.39 2001/09/16 13:21:27 jongfoster
- * Changes to use new list functions.
- *
- * Revision 1.38 2001/09/16 13:01:46 jongfoster
- * Removing redundant function call that zeroed zalloc()'d memory.
- *
- * Revision 1.37 2001/09/10 11:12:24 oes
- * Deleted unused variable
- *
- * Revision 1.36 2001/09/10 10:56:15 oes
- * Silenced compiler warnings
- *
- * Revision 1.35 2001/07/31 14:44:22 oes
- * Deleted unused size parameter from filter_popups()
- *
- * Revision 1.34 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.33 2001/07/29 19:32:00 jongfoster
- * Renaming _main() [mingw32 only] to real_main(), for ANSI compliance.
- *
- * Revision 1.32 2001/07/29 18:47:05 jongfoster
- * Adding missing #include "loadcfg.h"
- *
- * Revision 1.31 2001/07/29 12:17:48 oes
- * Applied pthread fix by Paul Lieverse
- *
- * Revision 1.30 2001/07/25 22:57:13 jongfoster
- * __BEOS__ no longer overrides FEATURE_PTHREAD.
- * This is because FEATURE_PTHREAD will soon be widely used, so I
- * want to keep it simple.
- *
- * Revision 1.29 2001/07/24 12:47:06 oes
- * Applied BeOS support update by Eugenia
- *
- * Revision 1.28 2001/07/23 13:26:12 oes
- * Fixed bug in popup-killing for the first read that caused binary garbage to be sent between headers and body
- *
- * Revision 1.27 2001/07/19 19:09:47 haroon
- * - Added code to take care of the situation where while processing the first
- * server response (which includes the server header), after finding the end
- * of the headers we were not looking past the end of the headers for
- * content modification. I enabled it for filter_popups.
- * Someone else should look to see if other similar operations should be
- * done to the discarded portion of the buffer.
- *
- * Note 2001/07/20: No, the other content modification mechanisms will process
- * the whole iob later anyway. --oes
- *
- * Revision 1.26 2001/07/18 12:31:36 oes
- * cosmetics
- *
- * Revision 1.25 2001/07/15 19:43:49 jongfoster
- * Supports POSIX threads.
- * Also removed some unused #includes.
- *
- * Revision 1.24 2001/07/13 14:00:40 oes
- * - Generic content modification scheme:
- * Each feature has its own applicability flag that is set
- * from csp->action->flags.
- * Replaced the "filtering" int flag , by a function pointer
- * "content_filter" to the function that will do the content
- * modification. If it is != NULL, the document will be buffered
- * and processed through *content_filter, which must set
- * csp->content_length and return a modified copy of the body
- * or return NULL (on failiure).
- * - Changed csp->is_text to the more generic bitmap csp->content_type
- * which can currently take the valued CT_TEXT or CT_GIF
- * - Reformatting etc
- * - Removed all #ifdef PCRS
- *
- * Revision 1.23 2001/07/02 02:28:25 iwanttokeepanon
- * Added "#ifdef ACL_FILES" conditional compilation to line 1291 to exclude
- * the `block_acl' call. This prevents a compilation error when the user
- * does not wish to use the "ACL" feature.
- *
- * Revision 1.22 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.21 2001/06/29 13:29:36 oes
- * - Cleaned up, improved comments
- * - Unified all possible interceptors (CGI,
- * block, trust, fast_redirect) in one
- * place, with one (CGI) answer generation
- * mechansim. Much clearer now.
- * - Removed the GIF image generation, which
- * is now done in filters.c:block_url()
- * - Made error conditions like domain lookup
- * failiure or (various) problems while talking
- * to the server use cgi.c:error_response()
- * instead of generating HTML/HTTP in chat() (yuck!)
- * - Removed logentry from cancelled commit
- *
- * Revision 1.20 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.19 2001/06/07 23:12:52 jongfoster
- * Replacing function pointer in struct gateway with a directly
- * called function forwarded_connect().
- * Replacing struct gateway with struct forward_spec
- *
- * Revision 1.18 2001/06/03 19:12:16 oes
- * introduced new cgi handling
- *
- * Revision 1.17 2001/06/01 20:07:23 jongfoster
- * Now uses action +image-blocker{} rather than config->tinygif
- *
- * Revision 1.16 2001/06/01 18:49:17 jongfoster
- * Replaced "list_share" with "list" - the tiny memory gain was not
- * worth the extra complexity.
- *
- * Revision 1.15 2001/05/31 21:24:47 jongfoster
- * Changed "permission" to "action" throughout.
- * Removed DEFAULT_USER_AGENT - it must now be specified manually.
- * Moved vanilla wafer check into chat(), since we must now
- * decide whether or not to add it based on the URL.
- *
- * Revision 1.14 2001/05/29 20:14:01 joergs
- * AmigaOS bugfix: PCRS needs a lot of stack, stacksize for child threads
- * increased.
- *
- * Revision 1.13 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.12 2001/05/27 22:17:04 oes
- *
- * - re_process_buffer no longer writes the modified buffer
- * to the client, which was very ugly. It now returns the
- * buffer, which it is then written by chat.
- *
- * - content_length now adjusts the Content-Length: header
- * for modified documents rather than crunch()ing it.
- * (Length info in csp->content_length, which is 0 for
- * unmodified documents)
- *
- * - For this to work, sed() is called twice when filtering.
- *
- * Revision 1.11 2001/05/26 17:27:53 jongfoster
- * Added support for CLF and fixed LOG_LEVEL_LOG.
- * Also did CRLF->LF fix of my previous patch.
- *
- * Revision 1.10 2001/05/26 15:26:15 jongfoster
- * ACL feature now provides more security by immediately dropping
- * connections from untrusted hosts.
- *
- * Revision 1.9 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.8 2001/05/25 22:43:18 jongfoster
- * Fixing minor memory leak and buffer overflow.
- *
- * Revision 1.7 2001/05/25 22:34:30 jongfoster
- * Hard tabs->Spaces
- *
- * Revision 1.6 2001/05/23 00:13:58 joergs
- * AmigaOS support fixed.
- *
- * Revision 1.5 2001/05/22 18:46:04 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.4 2001/05/21 19:34:01 jongfoster
- * Made failure to bind() a fatal error.
- *
- * Revision 1.3 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.2 2001/05/17 22:34:44 oes
- * - Added hint on GIF char array generation to jcc.c
- * - Cleaned CRLF's from the sources and related files
- * - Repaired logging for REF and FRC
- *
- * Revision 1.1.1.1 2001/05/15 13:58:56 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef JCC_H_INCLUDED
#define JCC_H_INCLUDED
-#define JCC_H_VERSION "$Id: jcc.h,v 1.24 2008/09/07 12:35:05 fabiankeil Exp $"
+#define JCC_H_VERSION "$Id: jcc.h,v 1.25 2008/10/09 18:21:41 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: jcc.h,v $
- * Revision 1.24 2008/09/07 12:35:05 fabiankeil
- * Add mutex lock support for _WIN32.
- *
- * Revision 1.23 2008/09/04 08:13:58 fabiankeil
- * Prepare for critical sections on Windows by adding a
- * layer of indirection before the pthread mutex functions.
- *
- * Revision 1.22 2007/06/01 18:16:36 fabiankeil
- * Use the same mutex for gethostbyname() and gethostbyaddr() to prevent
- * deadlocks and crashes on OpenBSD and possibly other OS with neither
- * gethostbyname_r() nor gethostaddr_r(). Closes BR#1729174.
- * Thanks to Ralf Horstmann for report and solution.
- *
- * Revision 1.21 2007/04/22 13:18:06 fabiankeil
- * Keep the HTTP snippets local.
- *
- * Revision 1.20 2006/12/26 17:31:41 fabiankeil
- * Mutex protect rand() if POSIX threading
- * is used, warn the user if that's not possible
- * and stop using it on _WIN32 where it could
- * cause crashes.
- *
- * Revision 1.19 2006/12/06 19:41:39 fabiankeil
- * Privoxy is now able to run as intercepting
- * proxy in combination with any packet filter
- * that does the port redirection. The destination
- * is extracted from the "Host:" header which
- * should be available for nearly all requests.
- *
- * Moved HTTP snipplets into jcc.c.
- * Added error message for gopher proxy requests.
- *
- * Revision 1.18 2006/11/13 19:05:51 fabiankeil
- * Make pthread mutex locking more generic. Instead of
- * checking for OSX and OpenBSD, check for FEATURE_PTHREAD
- * and use mutex locking unless there is an _r function
- * available. Better safe than sorry.
- *
- * Fixes "./configure --disable-pthread" and should result
- * in less threading-related problems on pthread-using platforms,
- * but it still doesn't fix BR#1122404.
- *
- * Revision 1.17 2006/11/06 19:58:23 fabiankeil
- * Move pthread.h inclusion from jcc.c to jcc.h.
- * Fixes build on x86-freebsd1 (FreeBSD 5.4-RELEASE).
- *
- * Revision 1.16 2006/09/02 15:36:42 fabiankeil
- * Follow the OpenBSD port's lead and protect the resolve
- * functions on OpenBSD as well.
- *
- * Revision 1.15 2006/09/02 10:24:30 fabiankeil
- * Include pthread.h for OpenBSD to make Privoxy build again.
- *
- * Tested shortly on OpenBSD 3.9 without problems, but the OpenBSD
- * port has additional patches to use the mutexes OSX_DARWIN needs,
- * and it should be investigated if they are still required for
- * reliable operation.
- *
- * Revision 1.14 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.12.2.3 2006/01/21 16:16:08 david__schmidt
- * Thanks to Edward Carrel for his patch to modernize OSX's\rpthreads support. See bug #1409623.
- *
- * Revision 1.12.2.2 2005/04/03 20:10:50 david__schmidt
- * Thanks to Jindrich Makovicka for a race condition fix for the log
- * file. The race condition remains for non-pthread implementations.
- * Reference patch #1175720.
- *
- * Revision 1.12.2.1 2003/03/07 03:41:05 david__schmidt
- * Wrapping all *_r functions (the non-_r versions of them) with mutex
- * semaphores for OSX. Hopefully this will take care of all of those pesky
- * crash reports.
- *
- * Revision 1.12 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.11 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.10 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.9 2002/03/07 03:52:44 oes
- * Set logging to tty for --no-daemon mode
- *
- * Revision 1.8 2002/03/04 18:19:49 oes
- * Added extern const char *pidfile
- *
- * Revision 1.7 2001/11/05 21:41:43 steudten
- * Add changes to be a real daemon just for unix os.
- * (change cwd to /, detach from controlling tty, set
- * process group and session leader to the own process.
- * Add DBG() Macro.
- * Add some fatal-error log message for failed malloc().
- * Add '-d' if compiled with 'configure --with-debug' to
- * enable debug output.
- *
- * Revision 1.6 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.5 2001/07/29 19:32:00 jongfoster
- * Renaming _main() [mingw32 only] to real_main(), for ANSI compliance.
- *
- * Revision 1.4 2001/07/29 18:58:15 jongfoster
- * Removing nested #includes, adding forward declarations for needed
- * structures, and changing the #define _FILENAME_H to FILENAME_H_INCLUDED.
- *
- * Revision 1.3 2001/07/18 12:31:58 oes
- * moved #define freez from jcc.h to project.h
- *
- * Revision 1.2 2001/05/31 21:24:47 jongfoster
- * Changed "permission" to "action" throughout.
- * Removed DEFAULT_USER_AGENT - it must now be specified manually.
- * Moved vanilla wafer check into chat(), since we must now
- * decide whether or not to add it based on the URL.
- *
- * Revision 1.1.1.1 2001/05/15 13:58:56 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char list_rcs[] = "$Id: list.c,v 1.19 2007/04/17 18:14:06 fabiankeil Exp $";
+const char list_rcs[] = "$Id: list.c,v 1.20 2007/05/14 16:56:07 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: list.c,v $
- * Revision 1.19 2007/04/17 18:14:06 fabiankeil
- * Add list_contains_item().
- *
- * Revision 1.18 2006/12/28 19:21:23 fabiankeil
- * Fixed gcc43 warning and enabled list_is_valid()'s loop
- * detection again. It was ineffective since the removal of
- * the arbitrary list length limit two years ago.
- *
- * Revision 1.17 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.15.2.2 2004/05/25 02:04:23 david__schmidt
- * Removed the "arbitrary" 1000 filter limit in file.c. See tracker #911950.
- *
- * Revision 1.15.2.1 2002/11/28 18:14:54 oes
- * Added unmap function that removes all items with a given
- * name from a map.
- *
- * Revision 1.15 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.14 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.13 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.12 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.11 2001/10/23 21:21:03 jongfoster
- * New error handling - error codes are now jb_errs, not ints.
- * Changed the way map() handles out-of-memory, to dramatically
- * reduce the amount of error-checking clutter needed.
- *
- * Revision 1.10 2001/09/16 17:30:24 jongfoster
- * Fixing a compiler warning.
- *
- * Revision 1.9 2001/09/16 13:20:29 jongfoster
- * Rewrite of list library. Now has seperate header and list_entry
- * structures. Also added a large sprinking of assert()s to the list
- * code.
- *
- * Revision 1.8 2001/08/07 14:00:20 oes
- * Fixed comment
- *
- * Revision 1.7 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.6 2001/07/31 14:44:51 oes
- * list_to_text() now appends empty line at end
- *
- * Revision 1.5 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.4 2001/06/29 13:30:22 oes
- * - Added Convenience function enlist_unique_header(),
- * which takes the Header name and value as separate
- * arguments and thus saves the pain of sprintf()ing
- * and determining the Header name length to enlist_unique
- * - Improved comments
- * - Removed logentry from cancelled commit
- *
- * Revision 1.3 2001/06/03 19:12:24 oes
- * functions for new struct map, extended enlist_unique
- *
- * Revision 1.2 2001/06/01 18:49:17 jongfoster
- * Replaced "list_share" with "list" - the tiny memory gain was not
- * worth the extra complexity.
- *
- * Revision 1.1 2001/05/31 21:11:53 jongfoster
- * - Moved linked list support to new "list.c" file.
- * Structure definitions are still in project.h,
- * function prototypes are now in "list.h".
- * - Added support for "struct list_share", which is identical
- * to "struct list" except it saves memory by not duplicating
- * the strings. Obviously, this only works if there is some
- * other way of managing the memory used by the strings.
- * (These list_share lists are used for lists which last
- * for only 1 request, and where all the list entries are
- * just coming directly from entries in the actionsfile.)
- * Note that you still need to destroy list_share lists
- * properly to free the nodes - it's only the strings
- * which are shared.
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef LIST_H_INCLUDED
#define LIST_H_INCLUDED
-#define LIST_H_VERSION "$Id: list.h,v 1.14 2006/07/18 14:48:46 david__schmidt Exp $"
+#define LIST_H_VERSION "$Id: list.h,v 1.15 2007/04/17 18:14:06 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: list.h,v $
- * Revision 1.14 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.12.2.1 2002/11/28 18:14:54 oes
- * Added unmap function that removes all items with a given
- * name from a map.
- *
- * Revision 1.12 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.11 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.10 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.9 2001/10/23 21:21:03 jongfoster
- * New error handling - error codes are now jb_errs, not ints.
- * Changed the way map() handles out-of-memory, to dramatically
- * reduce the amount of error-checking clutter needed.
- *
- * Revision 1.8 2001/09/16 17:30:24 jongfoster
- * Fixing a compiler warning.
- *
- * Revision 1.7 2001/09/16 13:20:29 jongfoster
- * Rewrite of list library. Now has seperate header and list_entry
- * structures. Also added a large sprinking of assert()s to the list
- * code.
- *
- * Revision 1.6 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.5 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.4 2001/06/29 13:30:37 oes
- * - Introduced enlist_unique_header()
- * - Removed logentry from cancelled commit
- *
- * Revision 1.3 2001/06/03 11:03:48 oes
- * introduced functions for new list type "map": map(), lookup(),
- * free_map(), and extended enlist_unique
- *
- * Revision 1.2 2001/06/01 18:49:17 jongfoster
- * Replaced "list_share" with "list" - the tiny memory gain was not
- * worth the extra complexity.
- *
- * Revision 1.1 2001/05/31 21:11:53 jongfoster
- * - Moved linked list support to new "list.c" file.
- * Structure definitions are still in project.h,
- * function prototypes are now in "list.h".
- * - Added support for "struct list_share", which is identical
- * to "struct list" except it saves memory by not duplicating
- * the strings. Obviously, this only works if there is some
- * other way of managing the memory used by the strings.
- * (These list_share lists are used for lists which last
- * for only 1 request, and where all the list entries are
- * just coming directly from entries in the actionsfile.)
- * Note that you still need to destroy list_share lists
- * properly to free the nodes - it's only the strings
- * which are shared.
- *
- *
*********************************************************************/
-\f
+
#include "project.h"
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.100 2009/05/10 10:19:23 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.101 2009/05/13 18:20:54 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: loadcfg.c,v $
- * Revision 1.100 2009/05/10 10:19:23 fabiankeil
- * Reenable server-side-only keep-alive support, but only share
- * outgoing connections if the connection-sharing option is set.
- *
- * Revision 1.99 2009/05/10 10:12:30 fabiankeil
- * Initial keep-alive support for the client socket.
- * Temporarily disable the server-side-only keep-alive code.
- *
- * Revision 1.98 2009/04/24 15:29:43 fabiankeil
- * Allow to limit the number of of client connections.
- *
- * Revision 1.97 2009/04/17 11:45:19 fabiankeil
- * Replace HAVE_GETADDRINFO and HAVE_GETNAMEINFO macros
- * with HAVE_RFC2553 macro. Original patch by Petr Pisar.
- *
- * Revision 1.96 2009/04/17 11:38:28 fabiankeil
- * Add and use parse_forwarder_address() to reduce code duplication.
- *
- * Revision 1.95 2009/04/17 11:34:34 fabiankeil
- * Style cosmetics for the IPv6 code.
- *
- * Revision 1.94 2009/04/17 11:27:49 fabiankeil
- * Petr Pisar's privoxy-3.0.12-ipv6-3.diff.
- *
- * Revision 1.93 2009/03/18 21:46:26 fabiankeil
- * Revert the last commit as there's a better way.
- *
- * Revision 1.92 2009/03/18 20:43:19 fabiankeil
- * Don't enable LOG_LEVEL_INFO by default and don't apply the user's
- * debug settings until the logfile has been opened (if there is one).
- * Patch submitted by Roland in #2624120.
- *
- * Revision 1.91 2009/03/09 17:29:08 fabiankeil
- * As of r1.88, the show-status page can use a single line for
- * warnings about ignored directives and the names of the ignored
- * directives themselves. Reminded by Lee, finally closes #1856559.
- *
- * Revision 1.90 2009/03/07 17:58:02 fabiankeil
- * Fix two mingw32-only buffer overflows. Note that triggering
- * them requires control over the configuration file in which
- * case all bets are off anyway.
- *
- * Revision 1.89 2009/03/01 18:46:33 fabiankeil
- * - Help clang understand that we aren't
- * dereferencing NULL pointers here.
- * - Some style fixes in the modified region.
- *
- * Revision 1.88 2009/02/28 10:57:10 fabiankeil
- * Gimme a break or two. Don't let the show-status page
- * link to the website documentation for the user-manual
- * directive itself.
- *
- * Revision 1.87 2009/02/15 07:56:13 fabiankeil
- * Increase default socket timeout to 300 seconds.
- *
- * Revision 1.86 2009/02/08 19:18:57 fabiankeil
- * Now that we have the match-all.action file, the other action
- * files changed their position in config->actions_file[] back
- * to the way it was before standard.action got removed and the
- * changes from revision 1.84 have to be reverted.
- *
- * Revision 1.85 2009/01/22 12:06:26 fabiankeil
- * Don't keep connections alive when running single-threaded.
- *
- * Revision 1.84 2009/01/14 16:14:36 fabiankeil
- * Due to the standard.action file removal, the other action
- * files changed their position in config->actions_file[].
- * Update mingw32 kludge accordingly.
- *
- * Revision 1.83 2008/12/20 14:53:55 fabiankeil
- * Add config option socket-timeout to control the time
- * Privoxy waits for data to arrive on a socket. Useful
- * in case of stale ssh tunnels or when fuzz-testing.
- *
- * Revision 1.82 2008/11/16 12:43:49 fabiankeil
- * Turn keep-alive support into a runtime feature
- * that is disabled by setting keep-alive-timeout
- * to a negative value.
- *
- * Revision 1.81 2008/11/13 09:08:42 fabiankeil
- * Add new config option: keep-alive-timeout.
- *
- * Revision 1.80 2008/08/31 15:59:03 fabiankeil
- * There's no reason to let remote toggling support depend
- * on FEATURE_CGI_EDIT_ACTIONS, so make sure it doesn't.
- *
- * Revision 1.79 2008/08/30 12:03:07 fabiankeil
- * Remove FEATURE_COOKIE_JAR.
- *
- * Revision 1.78 2008/08/02 08:23:22 fabiankeil
- * If the enforce-blocks directive is used with FEATURE_FORCE_LOAD
- * disabled, log a message that blocks will always be enforced
- * instead of complaining about an unrecognized directive.
- * Reported by Pietro Leone.
- *
- * Revision 1.77 2008/05/26 16:13:22 fabiankeil
- * Reuse directive_hash and don't hash the same directive twice.
- *
- * Revision 1.76 2008/05/10 09:03:16 fabiankeil
- * - Merge three string_append() calls.
- * - Remove useless assertion.
- *
- * Revision 1.75 2008/03/30 14:52:05 fabiankeil
- * Rename load_actions_file() and load_re_filterfile()
- * as they load multiple files "now".
- *
- * Revision 1.74 2008/03/26 18:07:07 fabiankeil
- * Add hostname directive. Closes PR#1918189.
- *
- * Revision 1.73 2008/02/16 16:54:51 fabiankeil
- * Fix typo.
- *
- * Revision 1.72 2008/02/03 13:46:15 fabiankeil
- * Add SOCKS5 support. Patch #1862863 by Eric M. Hopper with minor changes.
- *
- * Revision 1.71 2007/12/23 15:24:56 fabiankeil
- * Reword "unrecognized directive" warning, use better
- * mark up and add a <br>. Fixes parts of #1856559.
- *
- * Revision 1.70 2007/12/15 14:24:05 fabiankeil
- * Plug memory leak if listen-address only specifies the port.
- *
- * Revision 1.69 2007/10/27 13:02:27 fabiankeil
- * Relocate daemon-mode-related log messages to make sure
- * they aren't shown again in case of configuration reloads.
- *
- * Revision 1.68 2007/10/19 16:32:34 fabiankeil
- * Plug memory leak introduced with my last commit.
- *
- * Revision 1.67 2007/10/14 14:12:41 fabiankeil
- * When in daemon mode, close stderr after the configuration file has been
- * parsed the first time. If logfile isn't set, stop logging. Fixes BR#897436.
- *
- * Revision 1.66 2007/08/05 14:02:09 fabiankeil
- * #1763173 from Stefan Huehner: declare unload_configfile() static.
- *
- * Revision 1.65 2007/07/21 11:51:36 fabiankeil
- * As Hal noticed, checking dispatch_cgi() as the last cruncher
- * looks like a bug if CGI requests are blocked unintentionally,
- * so don't do it unless the user enabled the new config option
- * "allow-cgi-request-crunching".
- *
- * Revision 1.64 2007/05/21 10:44:08 fabiankeil
- * - Use strlcpy() instead of strcpy().
- * - Stop treating actions files special. Expect a complete file name
- * (with or without path) like it's done for the rest of the files.
- * Closes FR#588084.
- * - Remove an unnecessary temporary memory allocation.
- * - Don't log anything to the console when running as
- * daemon and no errors occurred.
- *
- * Revision 1.63 2007/04/09 18:11:36 fabiankeil
- * Don't mistake VC++'s _snprintf() for a snprintf() replacement.
- *
- * Revision 1.62 2007/03/17 15:20:05 fabiankeil
- * New config option: enforce-blocks.
- *
- * Revision 1.61 2007/03/16 16:47:35 fabiankeil
- * - Mention other reasons why acl directive loading might have failed.
- * - Don't log the acl source if the acl destination is to blame.
- *
- * Revision 1.60 2007/01/27 13:09:16 fabiankeil
- * Add new config option "templdir" to
- * change the templates directory.
- *
- * Revision 1.59 2006/12/31 17:56:38 fabiankeil
- * Added config option accept-intercepted-requests
- * and disabled it by default.
- *
- * Revision 1.58 2006/12/31 14:24:29 fabiankeil
- * Fix gcc43 compiler warnings.
- *
- * Revision 1.57 2006/12/21 12:57:48 fabiankeil
- * Add config option "split-large-forms"
- * to work around the browser bug reported
- * in BR #1570678.
- *
- * Revision 1.56 2006/12/17 17:04:51 fabiankeil
- * Move the <br> in the generated HTML for the config
- * options from the beginning of the string to its end.
- * Keeps the white space in balance.
- *
- * Revision 1.55 2006/11/28 15:31:52 fabiankeil
- * Fix memory leak in case of config file reloads.
- *
- * Revision 1.54 2006/10/21 16:04:22 fabiankeil
- * Modified kludge for win32 to make ming32 menu
- * "Options/Edit Filters" (sort of) work again.
- * Same limitations as for the action files apply.
- * Fixes BR 1567373.
- *
- * Revision 1.53 2006/09/06 18:45:03 fabiankeil
- * Incorporate modified version of Roland Rosenfeld's patch to
- * optionally access the user-manual via Privoxy. Closes patch 679075.
- *
- * Formatting changed to Privoxy style, added call to
- * cgi_error_no_template if the requested file doesn't
- * exist and modified check whether or not Privoxy itself
- * should serve the manual. Should work cross-platform now.
- *
- * Revision 1.52 2006/09/06 10:43:32 fabiankeil
- * Added config option enable-remote-http-toggle
- * to specify if Privoxy should recognize special
- * headers (currently only X-Filter) to change its
- * behaviour. Disabled by default.
- *
- * Revision 1.51 2006/09/06 09:23:37 fabiankeil
- * Make number of retries in case of forwarded-connect problems
- * a config file option (forwarded-connect-retries) and use 0 as
- * default.
- *
- * Revision 1.50 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.48.2.7 2006/02/02 17:29:16 david__schmidt
- * Don't forget to malloc space for the null terminator...
- *
- * Revision 1.48.2.6 2006/01/29 23:10:56 david__schmidt
- * Multiple filter file support
- *
- * Revision 1.48.2.5 2003/05/08 15:17:25 oes
- * Closed two memory leaks; hopefully the last remaining ones
- * (in the main execution paths, anyway).
- *
- * Revision 1.48.2.4 2003/04/11 12:06:14 oes
- * Addressed bug #719435
- * - Extraneous filterfile directives now logged as errors
- * - This and unrecnonised directives now really obvious on status page
- *
- * Revision 1.48.2.3 2003/03/11 11:53:59 oes
- * Cosmetic: Renamed cryptic variable
- *
- * Revision 1.48.2.2 2002/11/12 16:28:20 oes
- * Move unrelated variable declaration out of #ifdef FEATURE_ACL; fixes bug #636655
- *
- * Revision 1.48.2.1 2002/08/21 17:58:05 oes
- * Temp kludge to let user and default action file be edited through win32 GUI (FR 592080)
- *
- * Revision 1.48 2002/05/14 21:30:38 oes
- * savearg now uses own linking code instead of (now special-cased) add_help_link
- *
- * Revision 1.47 2002/05/12 21:36:29 jongfoster
- * Correcting function comments
- *
- * Revision 1.46 2002/04/26 12:55:14 oes
- * - New option "user-manual", defaults to our site
- * via project.h #define
- * - savearg now embeds option names in help links
- *
- * Revision 1.45 2002/04/24 02:11:54 oes
- * Jon's multiple AF patch: Allow up to MAX_AF_FILES actionsfile options
- *
- * Revision 1.44 2002/04/08 20:37:13 swa
- * fixed JB spelling
- *
- * Revision 1.43 2002/04/08 20:36:50 swa
- * fixed JB spelling
- *
- * Revision 1.42 2002/04/05 15:50:15 oes
- * fix for invalid HTML proxy_args
- *
- * Revision 1.41 2002/03/31 17:19:00 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.40 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.39 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.38 2002/03/24 13:05:48 jongfoster
- * Renaming re_filterfile to filterfile
- *
- * Revision 1.37 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.36 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.35 2002/03/07 03:52:44 oes
- * Set logging to tty for --no-daemon mode
- *
- * Revision 1.34 2002/03/06 23:14:35 jongfoster
- * Trivial cosmetic changes to make function comments easier to find.
- *
- * Revision 1.33 2002/03/05 04:52:42 oes
- * Deleted non-errlog debugging code
- *
- * Revision 1.32 2002/03/04 18:24:53 oes
- * Re-enabled output of unknown config directive hash
- *
- * Revision 1.31 2002/03/03 15:07:20 oes
- * Re-enabled automatic config reloading
- *
- * Revision 1.30 2002/01/22 23:31:43 jongfoster
- * Replacing strsav() with string_append()
- *
- * Revision 1.29 2002/01/17 21:02:30 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Revision 1.28 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.27 2001/11/07 00:02:13 steudten
- * Add line number in error output for lineparsing for
- * actionsfile and configfile.
- * Special handling for CLF added.
- *
- * Revision 1.26 2001/11/05 21:41:43 steudten
- * Add changes to be a real daemon just for unix os.
- * (change cwd to /, detach from controlling tty, set
- * process group and session leader to the own process.
- * Add DBG() Macro.
- * Add some fatal-error log message for failed malloc().
- * Add '-d' if compiled with 'configure --with-debug' to
- * enable debug output.
- *
- * Revision 1.25 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.24 2001/10/23 21:40:30 jongfoster
- * Added support for enable-edit-actions and enable-remote-toggle config
- * file options.
- *
- * Revision 1.23 2001/10/07 15:36:00 oes
- * Introduced new config option "buffer-limit"
- *
- * Revision 1.22 2001/09/22 16:36:59 jongfoster
- * Removing unused parameter fs from read_config_line()
- *
- * Revision 1.21 2001/09/16 17:10:43 jongfoster
- * Moving function savearg() here, since it was the only thing left in
- * showargs.c.
- *
- * Revision 1.20 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.19 2001/07/15 17:45:16 jongfoster
- * Removing some unused #includes
- *
- * Revision 1.18 2001/07/13 14:01:14 oes
- * - Removed all #ifdef PCRS
- * - Removed vim-settings
- *
- * Revision 1.17 2001/06/29 13:31:03 oes
- * - Improved comments
- * - Fixed (actionsfile) and sorted hashes
- * - Introduced admin_address and proxy-info-url
- * as config parameters
- * - Renamed config->proxy_args_invocation (which didn't have
- * the invocation but the options!) to config->proxy_args
- * - Various adaptions
- * - Removed logentry from cancelled commit
- *
- * Revision 1.16 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.15 2001/06/07 23:13:40 jongfoster
- * Merging ACL and forward files into config file.
- * Cosmetic: Sorting config file options alphabetically.
- * Cosmetic: Adding brief syntax comments to config file options.
- *
- * Revision 1.14 2001/06/07 14:46:25 joergs
- * Missing make_path() added for re_filterfile.
- *
- * Revision 1.13 2001/06/05 22:33:54 jongfoster
- *
- * Fixed minor memory leak.
- * Also now uses make_path to prepend the pathnames.
- *
- * Revision 1.12 2001/06/05 20:04:09 jongfoster
- * Now uses _snprintf() in place of snprintf() under Win32.
- *
- * Revision 1.11 2001/06/04 18:31:58 swa
- * files are now prefixed with either `confdir' or `logdir'.
- * `make redhat-dist' replaces both entries confdir and logdir
- * with redhat values
- *
- * Revision 1.10 2001/06/03 19:11:54 oes
- * introduced confdir option
- *
- * Revision 1.9 2001/06/01 20:06:24 jongfoster
- * Removed support for "tinygif" option - moved to actions file.
- *
- * Revision 1.8 2001/05/31 21:27:13 jongfoster
- * Removed many options from the config file and into the
- * "actions" file: add_forwarded, suppress_vanilla_wafer,
- * wafer, add_header, user_agent, referer, from
- * Also globally replaced "permission" with "action".
- *
- * Revision 1.7 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.6 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.5 2001/05/25 22:34:30 jongfoster
- * Hard tabs->Spaces
- *
- * Revision 1.4 2001/05/22 18:46:04 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.3 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.2 2001/05/17 23:01:01 oes
- * - Cleaned CRLF's from the sources and related files
- *
- * Revision 1.1.1.1 2001/05/15 13:58:58 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef LOADCFG_H_INCLUDED
#define LOADCFG_H_INCLUDED
-#define LOADCFG_H_VERSION "$Id: loadcfg.h,v 1.11.2.1 2003/03/11 11:53:59 oes Exp $"
+#define LOADCFG_H_VERSION "$Id: loadcfg.h,v 1.13 2006/07/18 14:48:46 david__schmidt Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/Attic/loadcfg.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/loadcfg.h,v $
*
* Purpose : Loads settings from the configuration file into
* global variables. This file contains both the
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: loadcfg.h,v $
- * Revision 1.11.2.1 2003/03/11 11:53:59 oes
- * Cosmetic: Renamed cryptic variable
- *
- * Revision 1.11 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.10 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.9 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.8 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.7 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.6 2001/07/29 18:58:15 jongfoster
- * Removing nested #includes, adding forward declarations for needed
- * structures, and changing the #define _FILENAME_H to FILENAME_H_INCLUDED.
- *
- * 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
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.3 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.2 2001/05/17 23:01:01 oes
- * - Cleaned CRLF's from the sources and related files
- *
- * Revision 1.1.1.1 2001/05/15 13:58:58 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char loaders_rcs[] = "$Id: loaders.c,v 1.71 2009/03/04 18:24:47 fabiankeil Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.72 2009/04/24 15:29:43 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: loaders.c,v $
- * Revision 1.71 2009/03/04 18:24:47 fabiankeil
- * No need to create empty strings manually, strdup("") FTW.
- *
- * Revision 1.70 2009/03/01 18:34:24 fabiankeil
- * Help clang understand that we aren't dereferencing
- * NULL pointers here.
- *
- * Revision 1.69 2008/09/21 13:36:52 fabiankeil
- * If change-x-forwarded-for{add} is used and the client
- * sends multiple X-Forwarded-For headers, append the client's
- * IP address to each one of them. "Traditionally" we would
- * lose all but the last one.
- *
- * Revision 1.68 2008/09/19 15:26:28 fabiankeil
- * Add change-x-forwarded-for{} action to block or add
- * X-Forwarded-For headers. Mostly based on code removed
- * before 3.0.7.
- *
- * Revision 1.67 2008/03/30 14:52:08 fabiankeil
- * Rename load_actions_file() and load_re_filterfile()
- * as they load multiple files "now".
- *
- * Revision 1.66 2008/03/21 11:16:30 fabiankeil
- * Garbage-collect csp->my_ip_addr_str and csp->my_hostname.
- *
- * Revision 1.65 2007/12/07 18:29:23 fabiankeil
- * Remove now-obsolete csp member x_forwarded.
- *
- * Revision 1.64 2007/06/01 14:12:38 fabiankeil
- * Add unload_forward_spec() in preparation for forward-override{}.
- *
- * Revision 1.63 2007/05/14 10:41:15 fabiankeil
- * Ditch the csp member cookie_list[] which isn't used anymore.
- *
- * Revision 1.62 2007/04/30 15:02:18 fabiankeil
- * Introduce dynamic pcrs jobs that can resolve variables.
- *
- * Revision 1.61 2007/04/15 16:39:21 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.60 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.59 2007/01/25 13:38:20 fabiankeil
- * Freez csp->error_message in sweep().
- *
- * Revision 1.58 2006/12/31 14:25:20 fabiankeil
- * Fix gcc43 compiler warnings.
- *
- * Revision 1.57 2006/12/21 12:22:22 fabiankeil
- * html_encode filter descriptions.
- *
- * Have "Ignoring job ..." error messages
- * print the filter file name correctly.
- *
- * Revision 1.56 2006/09/07 10:40:30 fabiankeil
- * Turns out trusted referrers above our arbitrary
- * limit are downgraded too ordinary trusted URLs.
- * Adjusted error message.
- *
- * Revision 1.55 2006/09/07 10:25:39 fabiankeil
- * Fix typo.
- *
- * Revision 1.54 2006/09/07 10:22:20 fabiankeil
- * If too many trusted referrers are used,
- * print only one error message instead of logging
- * every single trusted referrer above the arbitrary
- * limit.
- *
- * Revision 1.53 2006/08/31 16:25:06 fabiankeil
- * Work around a buffer overflow that caused Privoxy to
- * segfault if too many trusted referrers were used. Good
- * enough for now, but should be replaced with a real
- * solution after the next release.
- *
- * Revision 1.52 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.50.2.8 2006/01/30 15:16:25 david__schmidt
- * Remove a little residual debugging info
- *
- * Revision 1.50.2.7 2006/01/29 23:10:56 david__schmidt
- * Multiple filter file support
- *
- * Revision 1.50.2.6 2003/10/24 10:17:54 oes
- * Nit: Allowed tabs as separators in filter headings
- *
- * Revision 1.50.2.5 2003/05/08 15:19:15 oes
- * sweep: Made loop structure of sweep step mirror that of mark step
- *
- * Revision 1.50.2.4 2003/05/06 15:57:12 oes
- * Bugfix: Update last_active pointer in sweep() before
- * leaving an active client. Closes bugs #724395, #727882
- *
- * Revision 1.50.2.3 2002/11/20 17:12:30 oes
- * Ooops, forgot one change.
- *
- * Revision 1.50.2.2 2002/11/20 14:38:15 oes
- * Fixed delayed/incomplete freeing of client resources and
- * simplified loop structure in sweep.
- * Thanks to Oliver Stoeneberg for the hint.
- *
- * Revision 1.50.2.1 2002/07/26 15:19:24 oes
- * - PCRS jobs now chained in order of appearance. Previous
- * reverse chaining was counter-intuitive.
- * - Changed loglevel of PCRS job compile errors to
- * LOG_LEVEL_ERROR
- *
- * Revision 1.50 2002/04/24 02:12:16 oes
- * Jon's multiple AF patch: Sweep now takes care of all AFs
- *
- * Revision 1.49 2002/04/19 16:53:25 jongfoster
- * Optimize away a function call by using an equivalent macro
- *
- * Revision 1.48 2002/04/05 00:56:09 gliptak
- * Correcting typo to clean up on realloc failure
- *
- * Revision 1.47 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.46 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.45 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.44 2002/03/16 21:51:00 jongfoster
- * Fixing free(NULL).
- *
- * Revision 1.43 2002/03/16 20:28:34 oes
- * Added descriptions to the filters so users will know what they select in the cgi editor
- *
- * Revision 1.42 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.41 2002/03/12 01:42:50 oes
- * Introduced modular filters
- *
- * Revision 1.40 2002/03/08 17:46:04 jongfoster
- * Fixing int/size_t warnings
- *
- * Revision 1.39 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.38 2002/03/06 22:54:35 jongfoster
- * Automated function-comment nitpicking.
- *
- * Revision 1.37 2002/03/03 15:07:49 oes
- * Re-enabled automatic config reloading
- *
- * Revision 1.36 2002/01/22 23:46:18 jongfoster
- * Moving edit_read_line() and simple_read_line() to loaders.c, and
- * extending them to support reading MS-DOS, Mac and UNIX style files
- * on all platforms.
- *
- * Modifying read_config_line() (without changing it's prototype) to
- * be a trivial wrapper for edit_read_line(). This means that we have
- * one function to read a line and handle comments, which is common
- * between the initialization code and the edit interface.
- *
- * Revision 1.35 2002/01/17 21:03:08 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Revision 1.34 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.33 2001/11/13 00:16:38 jongfoster
- * Replacing references to malloc.h with the standard stdlib.h
- * (See ANSI or K&R 2nd Ed)
- *
- * Revision 1.32 2001/11/07 00:02:13 steudten
- * Add line number in error output for lineparsing for
- * actionsfile and configfile.
- * Special handling for CLF added.
- *
- * Revision 1.31 2001/10/26 17:39:01 oes
- * Removed csp->referrer
- * Moved ijb_isspace and ijb_tolower to project.h
- *
- * Revision 1.30 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.29 2001/10/23 21:38:53 jongfoster
- * Adding error-checking to create_url_spec()
- *
- * Revision 1.28 2001/10/07 15:40:39 oes
- * Replaced 6 boolean members of csp with one bitmap (csp->flags)
- *
- * Revision 1.27 2001/09/22 16:36:59 jongfoster
- * Removing unused parameter fs from read_config_line()
- *
- * Revision 1.26 2001/09/22 14:05:22 jongfoster
- * Bugfix: Multiple escaped "#" characters in a configuration
- * file are now permitted.
- * Also removing 3 unused headers.
- *
- * Revision 1.25 2001/09/13 22:44:03 jongfoster
- * Adding {} to an if statement
- *
- * Revision 1.24 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.23 2001/07/20 15:51:54 oes
- * Fixed indentation of prepocessor commands
- *
- * Revision 1.22 2001/07/20 15:16:17 haroon
- * - per Guy's suggestion, added a while loop in sweep() to catch not just
- * the last inactive CSP but all other consecutive inactive CSPs after that
- * as well
- *
- * Revision 1.21 2001/07/18 17:26:24 oes
- * Changed to conform to new pcrs interface
- *
- * Revision 1.20 2001/07/17 13:07:01 oes
- * Fixed segv when last line in config files
- * lacked a terminating (\r)\n
- *
- * Revision 1.19 2001/07/13 14:01:54 oes
- * Removed all #ifdef PCRS
- *
- * Revision 1.18 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.17 2001/06/29 13:31:51 oes
- * Various adaptions
- *
- * Revision 1.16 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.15 2001/06/07 23:14:14 jongfoster
- * Removing ACL and forward file loaders - these
- * files have been merged into the config file.
- * Cosmetic: Moving unloader funcs next to their
- * respective loader funcs
- *
- * Revision 1.14 2001/06/01 03:27:04 oes
- * Fixed line continuation problem
- *
- * Revision 1.13 2001/05/31 21:28:49 jongfoster
- * Removed all permissionsfile code - it's now called the actions
- * file, and (almost) all the code is in actions.c
- *
- * Revision 1.12 2001/05/31 17:32:31 oes
- *
- * - Enhanced domain part globbing with infix and prefix asterisk
- * matching and optional unanchored operation
- *
- * Revision 1.11 2001/05/29 23:25:24 oes
- *
- * - load_config_line() and load_permissions_file() now use chomp()
- *
- * Revision 1.10 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.9 2001/05/26 17:12:07 jongfoster
- * Fatal errors loading configuration files now give better error messages.
- *
- * Revision 1.8 2001/05/26 00:55:20 jongfoster
- * Removing duplicated code. load_forwardfile() now uses create_url_spec()
- *
- * Revision 1.7 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.6 2001/05/23 12:27:33 oes
- *
- * Fixed ugly indentation of my last changes
- *
- * Revision 1.5 2001/05/23 10:39:05 oes
- * - Added support for escaping the comment character
- * in config files by a backslash
- * - Added support for line continuation in config
- * files
- * - Fixed a buffer overflow bug with long config lines
- *
- * Revision 1.4 2001/05/22 18:56:28 oes
- * CRLF -> LF
- *
- * Revision 1.3 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.2 2001/05/17 23:01:01 oes
- * - Cleaned CRLF's from the sources and related files
- *
- * Revision 1.1.1.1 2001/05/15 13:58:59 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef LOADERS_H_INCLUDED
#define LOADERS_H_INCLUDED
-#define LOADERS_H_VERSION "$Id: loaders.h,v 1.23 2008/03/30 14:52:10 fabiankeil Exp $"
+#define LOADERS_H_VERSION "$Id: loaders.h,v 1.24 2009/04/24 15:29:43 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: loaders.h,v $
- * Revision 1.23 2008/03/30 14:52:10 fabiankeil
- * Rename load_actions_file() and load_re_filterfile()
- * as they load multiple files "now".
- *
- * Revision 1.22 2007/06/01 14:12:38 fabiankeil
- * Add unload_forward_spec() in preparation for forward-override{}.
- *
- * Revision 1.21 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.19 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.18 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.17 2002/03/16 23:54:06 jongfoster
- * Adding graceful termination feature, to help look for memory leaks.
- * If you enable this (which, by design, has to be done by hand
- * editing config.h) and then go to http://i.j.b/die, then the program
- * will exit cleanly after the *next* request. It should free all the
- * memory that was used.
- *
- * Revision 1.16 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.15 2002/01/22 23:46:18 jongfoster
- * Moving edit_read_line() and simple_read_line() to loaders.c, and
- * extending them to support reading MS-DOS, Mac and UNIX style files
- * on all platforms.
- *
- * Modifying read_config_line() (without changing it's prototype) to
- * be a trivial wrapper for edit_read_line(). This means that we have
- * one function to read a line and handle comments, which is common
- * between the initialization code and the edit interface.
- *
- * Revision 1.14 2002/01/17 21:03:08 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Revision 1.13 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.12 2001/11/07 00:02:13 steudten
- * Add line number in error output for lineparsing for
- * actionsfile and configfile.
- * Special handling for CLF added.
- *
- * Revision 1.11 2001/10/23 21:38:53 jongfoster
- * Adding error-checking to create_url_spec()
- *
- * Revision 1.10 2001/09/22 16:36:59 jongfoster
- * Removing unused parameter fs from read_config_line()
- *
- * Revision 1.9 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.8 2001/07/29 18:58:15 jongfoster
- * Removing nested #includes, adding forward declarations for needed
- * structures, and changing the #define _FILENAME_H to FILENAME_H_INCLUDED.
- *
- * Revision 1.7 2001/07/13 14:01:54 oes
- * Removed all #ifdef PCRS
- *
- * Revision 1.6 2001/06/07 23:14:38 jongfoster
- * Removing ACL and forward file loaders - these files have
- * been merged into the config file.
- *
- * Revision 1.5 2001/05/31 21:28:49 jongfoster
- * Removed all permissionsfile code - it's now called the actions
- * file, and (almost) all the code is in actions.c
- *
- * Revision 1.4 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.3 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.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:00 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char miscutil_rcs[] = "$Id: miscutil.c,v 1.61 2008/10/18 11:09:23 fabiankeil Exp $";
+const char miscutil_rcs[] = "$Id: miscutil.c,v 1.62 2008/12/04 18:16:41 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/miscutil.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: miscutil.c,v $
- * Revision 1.61 2008/10/18 11:09:23 fabiankeil
- * Improve seed used by pick_from_range() on mingw32.
- *
- * Revision 1.60 2008/09/07 12:35:05 fabiankeil
- * Add mutex lock support for _WIN32.
- *
- * Revision 1.59 2008/09/04 08:13:58 fabiankeil
- * Prepare for critical sections on Windows by adding a
- * layer of indirection before the pthread mutex functions.
- *
- * Revision 1.58 2008/04/17 14:53:30 fabiankeil
- * Move simplematch() into urlmatch.c as it's only
- * used to match (old-school) domain patterns.
- *
- * Revision 1.57 2008/03/24 15:29:51 fabiankeil
- * Pet gcc43.
- *
- * Revision 1.56 2007/12/01 12:59:05 fabiankeil
- * Some sanity checks for pick_from_range().
- *
- * Revision 1.55 2007/11/03 17:34:49 fabiankeil
- * Log the "weak randomization factor" warning only
- * once for mingw32 and provide some more details.
- *
- * Revision 1.54 2007/09/19 20:28:37 fabiankeil
- * If privoxy_strlcpy() is called with a "buffer" size
- * of 0, don't touch whatever destination points to.
- *
- * Revision 1.53 2007/09/09 18:20:20 fabiankeil
- * Turn privoxy_strlcpy() into a function and try to work with
- * b0rked snprintf() implementations too. Reported by icmp30.
- *
- * Revision 1.52 2007/08/19 12:32:34 fabiankeil
- * Fix a conversion warning.
- *
- * Revision 1.51 2007/06/17 16:12:22 fabiankeil
- * #ifdef _WIN32 the last commit. According to David Shaw,
- * one of the gnupg developers, the changes are mingw32-specific.
- *
- * Revision 1.50 2007/06/10 14:59:59 fabiankeil
- * Change replacement timegm() to better match our style, plug a small
- * but guaranteed memory leak and fix "time zone breathing" on mingw32.
- *
- * Revision 1.49 2007/05/11 11:48:15 fabiankeil
- * - Delete strsav() which was replaced
- * by string_append() years ago.
- * - Add a strlcat() look-alike.
- * - Use strlcat() and strlcpy() in those parts
- * of the code that are run on unixes.
- *
- * Revision 1.48 2007/04/09 17:48:51 fabiankeil
- * Check for HAVE_SNPRINTF instead of __OS2__
- * before including the portable snprintf() code.
- *
- * Revision 1.47 2007/03/17 11:52:15 fabiankeil
- * - Use snprintf instead of sprintf.
- * - Mention copyright for the replacement
- * functions in the copyright header.
- *
- * Revision 1.46 2007/01/18 15:03:20 fabiankeil
- * Don't include replacement timegm() if
- * putenv() or tzset() isn't available.
- *
- * Revision 1.45 2006/12/26 17:31:41 fabiankeil
- * Mutex protect rand() if POSIX threading
- * is used, warn the user if that's not possible
- * and stop using it on _WIN32 where it could
- * cause crashes.
- *
- * Revision 1.44 2006/11/07 12:46:43 fabiankeil
- * Silence compiler warning on NetBSD 3.1.
- *
- * Revision 1.43 2006/09/23 13:26:38 roro
- * Replace TABs by spaces in source code.
- *
- * Revision 1.42 2006/09/09 14:01:45 fabiankeil
- * Integrated Oliver Yeoh's domain pattern fix
- * to make sure *x matches xx. Closes Patch 1217393
- * and Bug 1170767.
- *
- * Revision 1.41 2006/08/18 16:03:17 david__schmidt
- * Tweak for OS/2 build happiness.
- *
- * Revision 1.40 2006/08/17 17:15:10 fabiankeil
- * - Back to timegm() using GnuPG's replacement if necessary.
- * Using mktime() and localtime() could add a on hour offset if
- * the randomize factor was big enough to lead to a summer/wintertime
- * switch.
- *
- * - Removed now-useless Privoxy 3.0.3 compatibility glue.
- *
- * - Moved randomization code into pick_from_range().
- *
- * - Changed parse_header_time definition.
- * time_t isn't guaranteed to be signed and
- * if it isn't, -1 isn't available as error code.
- * Changed some variable types in client_if_modified_since()
- * because of the same reason.
- *
- * Revision 1.39 2006/07/18 14:48:46 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.37.2.4 2003/12/01 14:45:14 oes
- * Fixed two more problems with wildcarding in simplematch()
- *
- * Revision 1.37.2.3 2003/11/20 11:39:24 oes
- * Bugfix: The "?" wildcard for domain names had never been implemented. Ooops\!
- *
- * Revision 1.37.2.2 2002/11/12 14:28:18 oes
- * Proper backtracking in simplematch; fixes bug #632888
- *
- * Revision 1.37.2.1 2002/09/25 12:58:51 oes
- * Made strcmpic and strncmpic safe against NULL arguments
- * (which are now treated as empty strings).
- *
- * Revision 1.37 2002/04/26 18:29:43 jongfoster
- * Fixing this Visual C++ warning:
- * miscutil.c(710) : warning C4090: '=' : different 'const' qualifiers
- *
- * Revision 1.36 2002/04/26 12:55:38 oes
- * New function string_toupper
- *
- * Revision 1.35 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.34 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.33 2002/03/07 03:46:53 oes
- * Fixed compiler warnings etc
- *
- * Revision 1.32 2002/03/06 23:02:57 jongfoster
- * Removing tabs
- *
- * Revision 1.31 2002/03/05 04:52:42 oes
- * Deleted non-errlog debugging code
- *
- * Revision 1.30 2002/03/04 18:27:42 oes
- * - Deleted deletePidFile
- * - Made write_pid_file use the --pidfile option value
- * (or no PID file, if the option was absent)
- * - Played styleguide police
- *
- * Revision 1.29 2002/03/04 02:08:02 david__schmidt
- * Enable web editing of actions file on OS/2 (it had been broken all this time!)
- *
- * Revision 1.28 2002/03/03 09:18:03 joergs
- * Made jumbjuster work on AmigaOS again.
- *
- * Revision 1.27 2002/01/21 00:52:32 jongfoster
- * Adding string_join()
- *
- * Revision 1.26 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.25 2001/11/13 00:16:38 jongfoster
- * Replacing references to malloc.h with the standard stdlib.h
- * (See ANSI or K&R 2nd Ed)
- *
- * Revision 1.24 2001/11/05 21:41:43 steudten
- * Add changes to be a real daemon just for unix os.
- * (change cwd to /, detach from controlling tty, set
- * process group and session leader to the own process.
- * Add DBG() Macro.
- * Add some fatal-error log message for failed malloc().
- * Add '-d' if compiled with 'configure --with-debug' to
- * enable debug output.
- *
- * Revision 1.23 2001/10/29 03:48:10 david__schmidt
- * OS/2 native needed a snprintf() routine. Added one to miscutil, brackedted
- * by and __OS2__ ifdef.
- *
- * Revision 1.22 2001/10/26 17:39:38 oes
- * Moved ijb_isspace and ijb_tolower to project.h
- *
- * Revision 1.21 2001/10/23 21:27:50 jongfoster
- * Standardising error codes in string_append
- * make_path() no longer adds '\\' if the dir already ends in '\\' (this
- * is just copying a UNIX-specific fix to the Windows-specific part)
- *
- * Revision 1.20 2001/10/22 15:33:56 david__schmidt
- * Special-cased OS/2 out of the Netscape-abort-on-404-in-js problem in
- * filters.c. Added a FIXME in front of the offending code. I'll gladly
- * put in a better/more robust fix for all parties if one is presented...
- * It seems that just returning 200 instead of 404 would pretty much fix
- * it for everyone, but I don't know all the history of the problem.
- *
- * Revision 1.19 2001/10/14 22:02:57 jongfoster
- * New function string_append() which is like strsav(), but running
- * out of memory isn't automatically FATAL.
- *
- * Revision 1.18 2001/09/20 13:33:43 steudten
- *
- * change long to int as return value in hash_string(). Remember the wraparound
- * for int = long = sizeof(4) - thats maybe not what we want.
- *
- * Revision 1.17 2001/09/13 20:51:29 jongfoster
- * Fixing potential problems with characters >=128 in simplematch()
- * This was also a compiler warning.
- *
- * Revision 1.16 2001/09/10 10:56:59 oes
- * Silenced compiler warnings
- *
- * Revision 1.15 2001/07/13 14:02:24 oes
- * Removed vim-settings
- *
- * Revision 1.14 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.13 2001/06/29 13:32:14 oes
- * Removed logentry from cancelled commit
- *
- * Revision 1.12 2001/06/09 10:55:28 jongfoster
- * Changing BUFSIZ ==> BUFFER_SIZE
- *
- * Revision 1.11 2001/06/07 23:09:19 jongfoster
- * Cosmetic indentation changes.
- *
- * Revision 1.10 2001/06/07 14:51:38 joergs
- * make_path() no longer adds '/' if the dir already ends in '/'.
- *
- * Revision 1.9 2001/06/07 14:43:17 swa
- * slight mistake in make_path, unix path style is /.
- *
- * Revision 1.8 2001/06/05 22:32:01 jongfoster
- * New function make_path() to splice directory and file names together.
- *
- * Revision 1.7 2001/06/03 19:12:30 oes
- * introduced bindup()
- *
- * Revision 1.6 2001/06/01 18:14:49 jongfoster
- * Changing the calls to strerr() to check HAVE_STRERR (which is defined
- * in config.h if appropriate) rather than the NO_STRERR macro.
- *
- * Revision 1.5 2001/06/01 10:31:51 oes
- * Added character class matching to trivimatch; renamed to simplematch
- *
- * Revision 1.4 2001/05/31 17:32:31 oes
- *
- * - Enhanced domain part globbing with infix and prefix asterisk
- * matching and optional unanchored operation
- *
- * Revision 1.3 2001/05/29 23:10:09 oes
- *
- *
- * - Introduced chomp()
- * - Moved strsav() from showargs to miscutil
- *
- * Revision 1.2 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.1.1.1 2001/05/15 13:59:00 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef MISCUTIL_H_INCLUDED
#define MISCUTIL_H_INCLUDED
-#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.29 2007/09/09 18:20:20 fabiankeil Exp $"
+#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.30 2008/04/17 14:53:31 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/miscutil.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: miscutil.h,v $
- * Revision 1.29 2007/09/09 18:20:20 fabiankeil
- * Turn privoxy_strlcpy() into a function and try to work with
- * b0rked snprintf() implementations too. Reported by icmp30.
- *
- * Revision 1.28 2007/05/11 11:48:16 fabiankeil
- * - Delete strsav() which was replaced
- * by string_append() years ago.
- * - Add a strlcat() look-alike.
- * - Use strlcat() and strlcpy() in those parts
- * of the code that are run on unixes.
- *
- * Revision 1.27 2007/04/09 17:48:51 fabiankeil
- * Check for HAVE_SNPRINTF instead of __OS2__
- * before including the portable snprintf() code.
- *
- * Revision 1.26 2007/04/08 17:04:51 fabiankeil
- * Add macro for strlcpy() in case the libc lacks it.
- *
- * Revision 1.25 2007/01/18 15:03:20 fabiankeil
- * Don't include replacement timegm() if
- * putenv() or tzset() isn't available.
- *
- * Revision 1.24 2006/08/17 17:15:10 fabiankeil
- * - Back to timegm() using GnuPG's replacement if necessary.
- * Using mktime() and localtime() could add a on hour offset if
- * the randomize factor was big enough to lead to a summer/wintertime
- * switch.
- *
- * - Removed now-useless Privoxy 3.0.3 compatibility glue.
- *
- * - Moved randomization code into pick_from_range().
- *
- * - Changed parse_header_time definition.
- * time_t isn't guaranteed to be signed and
- * if it isn't, -1 isn't available as error code.
- * Changed some variable types in client_if_modified_since()
- * because of the same reason.
- *
- * Revision 1.23 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.21 2002/04/26 12:55:38 oes
- * New function string_toupper
- *
- * Revision 1.20 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.19 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.18 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.17 2002/03/04 18:28:32 oes
- * Deleted deletePidFile, played syleguide police
- *
- * Revision 1.16 2002/01/21 00:53:36 jongfoster
- * Adding string_join()
- *
- * Revision 1.15 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.14 2001/11/05 21:43:48 steudten
- * Add global var 'basedir' for unix os.
- *
- * Revision 1.13 2001/10/29 03:48:10 david__schmidt
- * OS/2 native needed a snprintf() routine. Added one to miscutil, brackedted
- * by and __OS2__ ifdef.
- *
- * Revision 1.12 2001/10/23 21:27:50 jongfoster
- * Standardising error codes in string_append
- * make_path() no longer adds '\\' if the dir already ends in '\\' (this
- * is just copying a UNIX-specific fix to the Windows-specific part)
- *
- * Revision 1.11 2001/10/14 22:02:57 jongfoster
- * New function string_append() which is like strsav(), but running
- * out of memory isn't automatically FATAL.
- *
- * Revision 1.10 2001/09/20 13:34:09 steudten
- *
- * change long to int for prototype hash_string()
- *
- * Revision 1.9 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.8 2001/06/29 13:32:14 oes
- * Removed logentry from cancelled commit
- *
- * Revision 1.7 2001/06/05 22:32:01 jongfoster
- * New function make_path() to splice directory and file names together.
- *
- * Revision 1.6 2001/06/03 19:12:30 oes
- * introduced bindup()
- *
- * Revision 1.5 2001/06/01 10:31:51 oes
- * Added character class matching to trivimatch; renamed to simplematch
- *
- * Revision 1.4 2001/05/31 17:32:31 oes
- *
- * - Enhanced domain part globbing with infix and prefix asterisk
- * matching and optional unanchored operation
- *
- * Revision 1.3 2001/05/29 23:10:09 oes
- *
- *
- * - Introduced chomp()
- * - Moved strsav() from showargs to miscutil
- *
- * Revision 1.2 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.1.1.1 2001/05/15 13:59:00 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "project.h"
-const char parsers_rcs[] = "$Id: parsers.c,v 1.155 2009/05/10 10:12:30 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.156 2009/05/13 18:22:45 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: parsers.c,v $
- * Revision 1.155 2009/05/10 10:12:30 fabiankeil
- * Initial keep-alive support for the client socket.
- * Temporarily disable the server-side-only keep-alive code.
- *
- * Revision 1.154 2009/03/13 14:10:07 fabiankeil
- * Fix some more harmless warnings on amd64.
- *
- * Revision 1.153 2009/03/07 13:09:17 fabiankeil
- * Change csp->expected_content and_csp->expected_content_length from
- * size_t to unsigned long long to reduce the likelihood of integer
- * overflows that would let us close the connection prematurely.
- * Bug found while investigating #2669131, reported by cyberpatrol.
- *
- * Revision 1.152 2009/03/01 18:43:48 fabiankeil
- * Help clang understand that we aren't dereferencing
- * NULL pointers here.
- *
- * Revision 1.151 2009/02/15 14:46:35 fabiankeil
- * Don't let hide-referrer{conditional-*}} pass
- * Referer headers without http URLs.
- *
- * Revision 1.150 2008/12/04 18:12:19 fabiankeil
- * Fix some cparser warnings.
- *
- * Revision 1.149 2008/11/21 18:39:53 fabiankeil
- * In case of CONNECT requests there's no point
- * in trying to keep the connection alive.
- *
- * Revision 1.148 2008/11/16 12:43:49 fabiankeil
- * Turn keep-alive support into a runtime feature
- * that is disabled by setting keep-alive-timeout
- * to a negative value.
- *
- * Revision 1.147 2008/11/04 17:20:31 fabiankeil
- * HTTP/1.1 responses without Connection
- * header imply keep-alive. Act accordingly.
- *
- * Revision 1.146 2008/10/12 16:46:35 fabiankeil
- * Remove obsolete warning about delayed delivery with chunked
- * transfer encoding and FEATURE_CONNECTION_KEEP_ALIVE enabled.
- *
- * Revision 1.145 2008/10/09 18:21:41 fabiankeil
- * Flush work-in-progress changes to keep outgoing connections
- * alive where possible. Incomplete and mostly #ifdef'd out.
- *
- * Revision 1.144 2008/09/21 13:59:33 fabiankeil
- * Treat unknown change-x-forwarded-for parameters as fatal errors.
- *
- * Revision 1.143 2008/09/21 13:36:52 fabiankeil
- * If change-x-forwarded-for{add} is used and the client
- * sends multiple X-Forwarded-For headers, append the client's
- * IP address to each one of them. "Traditionally" we would
- * lose all but the last one.
- *
- * Revision 1.142 2008/09/20 10:04:33 fabiankeil
- * Remove hide-forwarded-for-headers action which has
- * been obsoleted by change-x-forwarded-for{block}.
- *
- * Revision 1.141 2008/09/19 15:26:28 fabiankeil
- * Add change-x-forwarded-for{} action to block or add
- * X-Forwarded-For headers. Mostly based on code removed
- * before 3.0.7.
- *
- * Revision 1.140 2008/09/12 17:51:43 fabiankeil
- * - A few style fixes.
- * - Remove a pointless cast.
- *
- * Revision 1.139 2008/09/04 08:13:58 fabiankeil
- * Prepare for critical sections on Windows by adding a
- * layer of indirection before the pthread mutex functions.
- *
- * Revision 1.138 2008/08/30 12:03:07 fabiankeil
- * Remove FEATURE_COOKIE_JAR.
- *
- * Revision 1.137 2008/05/30 15:50:08 fabiankeil
- * Remove questionable micro-optimizations
- * whose usefulness has never been measured.
- *
- * Revision 1.136 2008/05/26 16:02:24 fabiankeil
- * s@Insufficent@Insufficient@
- *
- * Revision 1.135 2008/05/21 20:12:10 fabiankeil
- * The whole point of strclean() is to modify the
- * first parameter, so don't mark it immutable,
- * even though the compiler lets us get away with it.
- *
- * Revision 1.134 2008/05/21 19:27:25 fabiankeil
- * As the wafer actions are gone, we can stop including encode.h.
- *
- * Revision 1.133 2008/05/21 15:50:47 fabiankeil
- * Ditch cast from (char **) to (char **).
- *
- * Revision 1.132 2008/05/21 15:47:14 fabiankeil
- * Streamline sed()'s prototype and declare
- * the header parse and add structures static.
- *
- * Revision 1.131 2008/05/20 20:13:30 fabiankeil
- * Factor update_server_headers() out of sed(), ditch the
- * first_run hack and make server_patterns_light static.
- *
- * Revision 1.130 2008/05/19 17:18:04 fabiankeil
- * Wrap memmove() calls in string_move()
- * to document the purpose in one place.
- *
- * Revision 1.129 2008/05/17 14:02:07 fabiankeil
- * Normalize linear header white space.
- *
- * Revision 1.128 2008/05/16 16:39:03 fabiankeil
- * If a header is split across multiple lines,
- * merge them to a single line before parsing them.
- *
- * Revision 1.127 2008/05/10 13:23:38 fabiankeil
- * Don't provide get_header() with the whole client state
- * structure when it only needs access to csp->iob.
- *
- * Revision 1.126 2008/05/03 16:40:45 fabiankeil
- * Change content_filters_enabled()'s parameter from
- * csp->action to action so it can be also used in the
- * CGI code. Don't bother checking if there are filters
- * loaded, as that's somewhat besides the point.
- *
- * Revision 1.125 2008/04/17 14:40:49 fabiankeil
- * Provide get_http_time() with the buffer size so it doesn't
- * have to blindly assume that the buffer is big enough.
- *
- * Revision 1.124 2008/04/16 16:38:21 fabiankeil
- * Don't pass the whole csp structure to flush_socket()
- * when it only needs a file descriptor and a buffer.
- *
- * Revision 1.123 2008/03/29 12:13:46 fabiankeil
- * Remove send-wafer and send-vanilla-wafer actions.
- *
- * Revision 1.122 2008/03/28 15:13:39 fabiankeil
- * Remove inspect-jpegs action.
- *
- * Revision 1.121 2008/01/05 21:37:03 fabiankeil
- * Let client_range() also handle Request-Range headers
- * which apparently are still supported by many servers.
- *
- * Revision 1.120 2008/01/04 17:43:45 fabiankeil
- * Improve the warning messages that get logged if the action files
- * "enable" filters but no filters of that type have been loaded.
- *
- * Revision 1.119 2007/12/28 18:32:51 fabiankeil
- * In server_content_type():
- * - Don't require leading white space when detecting image content types.
- * - Change '... not replaced ...' message to sound less crazy if the text
- * type actually is 'text/plain'.
- * - Mark the 'text/plain == binary data' assumption for removal.
- * - Remove a bunch of trailing white space.
- *
- * Revision 1.118 2007/12/28 16:56:35 fabiankeil
- * Minor server_content_disposition() changes:
- * - Don't regenerate the header name all lower-case.
- * - Some white space fixes.
- * - Remove useless log message in case of ENOMEM.
- *
- * Revision 1.117 2007/12/06 18:11:50 fabiankeil
- * Garbage-collect the code to add a X-Forwarded-For
- * header as it seems to be mostly used by accident.
- *
- * Revision 1.116 2007/12/01 13:04:22 fabiankeil
- * Fix a crash on mingw32 with some Last Modified times in the future.
- *
- * Revision 1.115 2007/11/02 16:52:50 fabiankeil
- * Remove a "can't happen" error block which, over
- * time, mutated into a "guaranteed to happen" block.
- *
- * Revision 1.114 2007/10/19 16:56:26 fabiankeil
- * - Downgrade "Buffer limit reached" message to LOG_LEVEL_INFO.
- * - Use shiny new content_filters_enabled() in client_range().
- *
- * Revision 1.113 2007/10/10 17:29:57 fabiankeil
- * I forgot about Poland.
- *
- * Revision 1.112 2007/10/09 16:38:40 fabiankeil
- * Remove Range and If-Range headers if content filtering is enabled.
- *
- * Revision 1.111 2007/10/04 18:07:00 fabiankeil
- * Move ACTION_VANILLA_WAFER handling from jcc's chat() into
- * client_cookie_adder() to make sure send-vanilla-wafer can be
- * controlled through tags (and thus regression-tested).
- *
- * Revision 1.110 2007/09/29 10:42:37 fabiankeil
- * - Remove "scanning headers for" log message again.
- * - Some more whitespace fixes.
- *
- * Revision 1.109 2007/09/08 14:25:48 fabiankeil
- * Refactor client_referrer() and add conditional-forge parameter.
- *
- * Revision 1.108 2007/08/28 18:21:03 fabiankeil
- * A bunch of whitespace fixes, pointy hat to me.
- *
- * Revision 1.107 2007/08/28 18:16:32 fabiankeil
- * Fix possible memory corruption in server_http, make sure it's not
- * executed for ordinary server headers and mark some problems for later.
- *
- * Revision 1.106 2007/08/18 14:30:32 fabiankeil
- * Let content-type-overwrite{} honour force-text-mode again.
- *
- * Revision 1.105 2007/08/11 14:49:49 fabiankeil
- * - Add prototpyes for the header parsers and make them static.
- * - Comment out client_accept_encoding_adder() which isn't used right now.
- *
- * Revision 1.104 2007/07/14 07:38:19 fabiankeil
- * Move the ACTION_FORCE_TEXT_MODE check out of
- * server_content_type(). Signal other functions
- * whether or not a content type has been declared.
- * Part of the fix for BR#1750917.
- *
- * Revision 1.103 2007/06/01 16:31:54 fabiankeil
- * Change sed() to return a jb_err in preparation for forward-override{}.
- *
- * Revision 1.102 2007/05/27 12:39:32 fabiankeil
- * Adjust "X-Filter: No" to disable dedicated header filters.
- *
- * Revision 1.101 2007/05/14 10:16:41 fabiankeil
- * Streamline client_cookie_adder().
- *
- * Revision 1.100 2007/04/30 15:53:11 fabiankeil
- * Make sure filters with dynamic jobs actually use them.
- *
- * Revision 1.99 2007/04/30 15:06:26 fabiankeil
- * - Introduce dynamic pcrs jobs that can resolve variables.
- * - Remove unnecessary update_action_bits_for_all_tags() call.
- *
- * Revision 1.98 2007/04/17 18:32:10 fabiankeil
- * - Make tagging based on tags set by earlier taggers
- * of the same kind possible.
- * - Log whether or not new tags cause action bits updates
- * (in which case a matching tag-pattern section exists).
- * - Log if the user tries to set a tag that is already set.
- *
- * Revision 1.97 2007/04/15 16:39:21 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.96 2007/04/12 12:53:58 fabiankeil
- * Log a warning if the content is compressed, filtering is
- * enabled and Privoxy was compiled without zlib support.
- * Closes FR#1673938.
- *
- * Revision 1.95 2007/03/25 14:26:40 fabiankeil
- * - Fix warnings when compiled with glibc.
- * - Don't use crumble() for cookie crunching.
- * - Move cookie time parsing into parse_header_time().
- * - Let parse_header_time() return a jb_err code
- * instead of a pointer that can only be used to
- * check for NULL anyway.
- *
- * Revision 1.94 2007/03/21 12:23:53 fabiankeil
- * - Add better protection against malicious gzip headers.
- * - Stop logging the first hundred bytes of decompressed content.
- * It looks like it's working and there is always debug 16.
- * - Log the content size after decompression in decompress_iob()
- * instead of pcrs_filter_response().
- *
- * Revision 1.93 2007/03/20 15:21:44 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".
- * - Remove filter_client_header() and filter_client_header(),
- * filter_header() now checks the shiny new
- * CSP_FLAG_CLIENT_HEADER_PARSING_DONE flag instead.
- *
- * Revision 1.92 2007/03/05 13:25:32 fabiankeil
- * - Cosmetical changes for LOG_LEVEL_RE_FILTER messages.
- * - Handle "Cookie:" and "Connection:" headers a bit smarter
- * (don't crunch them just to recreate them later on).
- * - Add another non-standard time format for the cookie
- * expiration date detection.
- * - Fix a valgrind warning.
- *
- * Revision 1.91 2007/02/24 12:27:32 fabiankeil
- * Improve cookie expiration date detection.
- *
- * Revision 1.90 2007/02/08 19:12:35 fabiankeil
- * Don't run server_content_length() the first time
- * sed() parses server headers; only adjust the
- * Content-Length header if the page was modified.
- *
- * Revision 1.89 2007/02/07 16:52:11 fabiankeil
- * Fix log messages regarding the cookie time format
- * (cookie and request URL were mixed up).
- *
- * Revision 1.88 2007/02/07 11:27:12 fabiankeil
- * - Let decompress_iob()
- * - not corrupt the content if decompression fails
- * early. (the first byte(s) were lost).
- * - use pointer arithmetics with defined outcome for
- * a change.
- * - Use a different kludge to remember a failed decompression.
- *
- * Revision 1.87 2007/01/31 16:21:38 fabiankeil
- * Search for Max-Forwards headers case-insensitive,
- * don't generate the "501 unsupported" message for invalid
- * Max-Forwards values and don't increase negative ones.
- *
- * Revision 1.86 2007/01/30 13:05:26 fabiankeil
- * - Let server_set_cookie() check the expiration date
- * of cookies and don't touch the ones that are already
- * expired. Fixes problems with low quality web applications
- * as described in BR 932612.
- *
- * - Adjust comment in client_max_forwards to reality;
- * remove invalid Max-Forwards headers.
- *
- * Revision 1.85 2007/01/26 15:33:46 fabiankeil
- * Stop filter_header() from unintentionally removing
- * empty header lines that were enlisted by the continue
- * hack.
- *
- * Revision 1.84 2007/01/24 12:56:52 fabiankeil
- * - Repeat the request URL before logging any headers.
- * Makes reading the log easier in case of simultaneous requests.
- * - If there are more than one Content-Type headers in one request,
- * use the first one and remove the others.
- * - Remove "newval" variable in server_content_type().
- * It's only used once.
- *
- * Revision 1.83 2007/01/12 15:03:02 fabiankeil
- * Correct a cast, check inflateEnd() exit code
- * to see if we have to, replace sprintf calls
- * with snprintf.
- *
- * Revision 1.82 2007/01/01 19:36:37 fabiankeil
- * Integrate a modified version of Wil Mahan's
- * zlib patch (PR #895531).
- *
- * Revision 1.81 2006/12/31 22:21:33 fabiankeil
- * Skip empty filter files in filter_header()
- * but don't ignore the ones that come afterwards.
- * Fixes BR 1619208, this time for real.
- *
- * Revision 1.80 2006/12/29 19:08:22 fabiankeil
- * Reverted parts of my last commit
- * to keep error handling working.
- *
- * Revision 1.79 2006/12/29 18:04:40 fabiankeil
- * Fixed gcc43 conversion warnings.
- *
- * Revision 1.78 2006/12/26 17:19:20 fabiankeil
- * Bringing back the "useless" localtime() call
- * I removed in revision 1.67. On some platforms
- * it's necessary to prevent time zone offsets.
- *
- * Revision 1.77 2006/12/07 18:44:26 fabiankeil
- * Rebuild request URL in get_destination_from_headers()
- * to make sure redirect{pcrs command} works as expected
- * for intercepted requests.
- *
- * Revision 1.76 2006/12/06 19:52:25 fabiankeil
- * Added get_destination_from_headers().
- *
- * Revision 1.75 2006/11/13 19:05:51 fabiankeil
- * Make pthread mutex locking more generic. Instead of
- * checking for OSX and OpenBSD, check for FEATURE_PTHREAD
- * and use mutex locking unless there is an _r function
- * available. Better safe than sorry.
- *
- * Fixes "./configure --disable-pthread" and should result
- * in less threading-related problems on pthread-using platforms,
- * but it still doesn't fix BR#1122404.
- *
- * Revision 1.74 2006/10/02 16:59:12 fabiankeil
- * The special header "X-Filter: No" now disables
- * header filtering as well.
- *
- * Revision 1.73 2006/09/23 13:26:38 roro
- * Replace TABs by spaces in source code.
- *
- * Revision 1.72 2006/09/23 12:37:21 fabiankeil
- * Don't print a log message every time filter_headers is
- * entered or left. It only creates noise without any real
- * information.
- *
- * Revision 1.71 2006/09/21 19:55:17 fabiankeil
- * Fix +hide-if-modified-since{-n}.
- *
- * Revision 1.70 2006/09/08 12:06:34 fabiankeil
- * Have hide-if-modified-since interpret the random
- * range value as minutes instead of hours. Allows
- * more fine-grained configuration.
- *
- * Revision 1.69 2006/09/06 16:25:51 fabiankeil
- * Always have parse_header_time return a pointer
- * that actual makes sense, even though we currently
- * only need it to detect problems.
- *
- * Revision 1.68 2006/09/06 10:43:32 fabiankeil
- * Added config option enable-remote-http-toggle
- * to specify if Privoxy should recognize special
- * headers (currently only X-Filter) to change its
- * behaviour. Disabled by default.
- *
- * Revision 1.67 2006/09/04 11:01:26 fabiankeil
- * After filtering de-chunked instances, remove
- * "Transfer-Encoding" header entirely instead of changing
- * it to "Transfer-Encoding: identity", which is invalid.
- * Thanks Michael Shields <shields@msrl.com>. Fixes PR 1318658.
- *
- * Don't use localtime in parse_header_time. An empty time struct
- * is good enough, it gets overwritten by strptime anyway.
- *
- * Revision 1.66 2006/09/03 19:38:28 fabiankeil
- * Use gmtime_r if available, fallback to gmtime with mutex
- * protection for MacOSX and use vanilla gmtime for the rest.
- *
- * Revision 1.65 2006/08/22 10:55:56 fabiankeil
- * Changed client_referrer to use the right type (size_t) for
- * hostlenght and to shorten the temporary referrer string with
- * '\0' instead of adding a useless line break.
- *
- * Revision 1.64 2006/08/17 17:15:10 fabiankeil
- * - Back to timegm() using GnuPG's replacement if necessary.
- * Using mktime() and localtime() could add a on hour offset if
- * the randomize factor was big enough to lead to a summer/wintertime
- * switch.
- *
- * - Removed now-useless Privoxy 3.0.3 compatibility glue.
- *
- * - Moved randomization code into pick_from_range().
- *
- * - Changed parse_header_time definition.
- * time_t isn't guaranteed to be signed and
- * if it isn't, -1 isn't available as error code.
- * Changed some variable types in client_if_modified_since()
- * because of the same reason.
- *
- * Revision 1.63 2006/08/14 13:18:08 david__schmidt
- * OS/2 compilation compatibility fixups
- *
- * Revision 1.62 2006/08/14 08:58:42 fabiankeil
- * Changed include from strptime.c to strptime.h
- *
- * Revision 1.61 2006/08/14 08:25:19 fabiankeil
- * Split filter-headers{} into filter-client-headers{}
- * and filter-server-headers{}.
- * Added parse_header_time() to share some code.
- * Replaced timegm() with mktime().
- *
- * Revision 1.60 2006/08/12 03:54:37 david__schmidt
- * Windows service integration
- *
- * Revision 1.59 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.58 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.56.2.10 2006/01/21 16:16:08 david__schmidt
- * Thanks to Edward Carrel for his patch to modernize OSX's\rpthreads support. See bug #1409623.
- *
- * Revision 1.56.2.9 2004/10/03 12:53:45 david__schmidt
- * Add the ability to check jpeg images for invalid
- * lengths of comment blocks. Defensive strategy
- * against the exploit:
- * Microsoft Security Bulletin MS04-028
- * Buffer Overrun in JPEG Processing (GDI+) Could
- * Allow Code Execution (833987)
- * Enabled with +inspect-jpegs in actions files.
- *
- * Revision 1.56.2.8 2003/07/11 13:21:25 oes
- * Excluded text/plain objects from filtering. This fixes a
- * couple of client-crashing, download corruption and
- * Privoxy performance issues, whose root cause lies in
- * web servers labelling content of unknown type as text/plain.
- *
- * Revision 1.56.2.7 2003/05/06 12:07:26 oes
- * Fixed bug #729900: Suspicious HOST: headers are now killed and regenerated if necessary
- *
- * Revision 1.56.2.6 2003/04/14 21:28:30 oes
- * Completing the previous change
- *
- * Revision 1.56.2.5 2003/04/14 12:08:16 oes
- * Added temporary workaround for bug in PHP < 4.2.3
- *
- * Revision 1.56.2.4 2003/03/07 03:41:05 david__schmidt
- * Wrapping all *_r functions (the non-_r versions of them) with mutex semaphores for OSX. Hopefully this will take care of all of those pesky crash reports.
- *
- * Revision 1.56.2.3 2002/11/10 04:20:02 hal9
- * Fix typo: supressed -> suppressed
- *
- * Revision 1.56.2.2 2002/09/25 14:59:53 oes
- * Improved cookie logging
- *
- * Revision 1.56.2.1 2002/09/25 14:52:45 oes
- * Added basic support for OPTIONS and TRACE HTTP methods:
- * - New parser function client_max_forwards which decrements
- * the Max-Forwards HTTP header field of OPTIONS and TRACE
- * requests by one before forwarding
- * - New parser function client_host which extracts the host
- * and port information from the HTTP header field if the
- * request URI was not absolute
- * - Don't crumble and re-add the Host: header, but only generate
- * and append if missing
- *
- * Revision 1.56 2002/05/12 15:34:22 jongfoster
- * Fixing typo in a comment
- *
- * Revision 1.55 2002/05/08 16:01:07 oes
- * Optimized add_to_iob:
- * - Use realloc instead of malloc(), memcpy(), free()
- * - Expand to powers of two if possible, to get
- * O(log n) reallocs instead of O(n).
- * - Moved check for buffer limit here from chat
- * - Report failure via returncode
- *
- * Revision 1.54 2002/04/02 15:03:16 oes
- * Tiny code cosmetics
- *
- * Revision 1.53 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.52 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.51 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.50 2002/03/12 01:45:35 oes
- * More verbose logging
- *
- * Revision 1.49 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.48 2002/03/07 03:46:53 oes
- * Fixed compiler warnings etc
- *
- * Revision 1.47 2002/02/20 23:15:13 jongfoster
- * Parsing functions now handle out-of-memory gracefully by returning
- * an error code.
- *
- * Revision 1.46 2002/01/17 21:03:47 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Revision 1.45 2002/01/09 14:33:03 oes
- * Added support for localtime_r.
- *
- * Revision 1.44 2001/12/14 01:22:54 steudten
- * Remove 'user:pass@' from 'proto://user:pass@host' for the
- * new added header 'Host: ..'. (See Req ID 491818)
- *
- * Revision 1.43 2001/11/23 00:26:38 jongfoster
- * Fixing two really stupid errors in my previous commit
- *
- * Revision 1.42 2001/11/22 21:59:30 jongfoster
- * Adding code to handle +no-cookies-keep
- *
- * Revision 1.41 2001/11/05 23:43:05 steudten
- * Add time+date to log files.
- *
- * Revision 1.40 2001/10/26 20:13:09 jongfoster
- * ctype.h is needed in Windows, too.
- *
- * Revision 1.39 2001/10/26 17:40:04 oes
- * Introduced get_header_value()
- * Removed http->user_agent, csp->referrer and csp->accept_types
- * Removed client_accept()
- *
- * Revision 1.38 2001/10/25 03:40:48 david__schmidt
- * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
- * threads to call select() simultaneously. So, it's time to do a real, live,
- * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
- * (native). Both versions will work, but using __OS2__ offers multi-threading.
- *
- * Revision 1.37 2001/10/23 21:36:02 jongfoster
- * Documenting sed()'s error behaviou (doc change only)
- *
- * Revision 1.36 2001/10/13 12:51:51 joergs
- * Removed client_host, (was only required for the old 2.0.2-11 http://noijb.
- * force-load), instead crumble Host: and add it (again) in client_host_adder
- * (in case we get a HTTP/1.0 request without Host: header and forward it to
- * a HTTP/1.1 server/proxy).
- *
- * Revision 1.35 2001/10/09 22:39:21 jongfoster
- * assert.h is also required under Win32, so moving out of #ifndef _WIN32
- * block.
- *
- * Revision 1.34 2001/10/07 18:50:55 oes
- * Added server_content_encoding, renamed server_transfer_encoding
- *
- * Revision 1.33 2001/10/07 18:04:49 oes
- * Changed server_http11 to server_http and its pattern to "HTTP".
- * Additional functionality: it now saves the HTTP status into
- * csp->http->status and sets CT_TABOO for Status 206 (partial range)
- *
- * Revision 1.32 2001/10/07 15:43:28 oes
- * Removed FEATURE_DENY_GZIP and replaced it with client_accept_encoding,
- * client_te and client_accept_encoding_adder, triggered by the new
- * +no-compression action. For HTTP/1.1 the Accept-Encoding header is
- * changed to allow only identity and chunked, and the TE header is
- * crunched. For HTTP/1.0, Accept-Encoding is crunched.
- *
- * parse_http_request no longer does anything than parsing. The rewriting
- * of http->cmd and version mangling are gone. It now also recognizes
- * the put and delete methods and saves the url in http->url. Removed
- * unused variable.
- *
- * renamed content_type and content_length to have the server_ prefix
- *
- * server_content_type now only works if csp->content_type != CT_TABOO
- *
- * added server_transfer_encoding, which
- * - Sets CT_TABOO to prohibit filtering if encoding compresses
- * - Raises the CSP_FLAG_CHUNKED flag if Encoding is "chunked"
- * - Change from "chunked" to "identity" if body was chunked
- * but has been de-chunked for filtering.
- *
- * added server_content_md5 which crunches any Content-MD5 headers
- * if the body was modified.
- *
- * made server_http11 conditional on +downgrade action
- *
- * Replaced 6 boolean members of csp with one bitmap (csp->flags)
- *
- * Revision 1.31 2001/10/05 14:25:02 oes
- * Crumble Keep-Alive from Server
- *
- * Revision 1.30 2001/09/29 12:56:03 joergs
- * IJB now changes HTTP/1.1 to HTTP/1.0 in requests and answers.
- *
- * Revision 1.29 2001/09/24 21:09:24 jongfoster
- * Fixing 2 memory leaks that Guy spotted, where the paramater to
- * enlist() was not being free()d.
- *
- * Revision 1.28 2001/09/22 16:32:28 jongfoster
- * Removing unused #includes.
- *
- * Revision 1.27 2001/09/20 15:45:25 steudten
- *
- * add casting from size_t to int for printf()
- * remove local variable shadow s2
- *
- * Revision 1.26 2001/09/16 17:05:14 jongfoster
- * Removing unused #include showarg.h
- *
- * Revision 1.25 2001/09/16 13:21:27 jongfoster
- * Changes to use new list functions.
- *
- * Revision 1.24 2001/09/13 23:05:50 jongfoster
- * Changing the string paramater to the header parsers a "const".
- *
- * Revision 1.23 2001/09/12 18:08:19 steudten
- *
- * In parse_http_request() header rewriting miss the host value, so
- * from http://www.mydomain.com the result was just " / " not
- * http://www.mydomain.com/ in case we forward.
- *
- * Revision 1.22 2001/09/10 10:58:53 oes
- * Silenced compiler warnings
- *
- * Revision 1.21 2001/07/31 14:46:00 oes
- * - Persistant connections now suppressed
- * - sed() no longer appends empty header to csp->headers
- *
- * Revision 1.20 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.19 2001/07/25 17:21:54 oes
- * client_uagent now saves copy of User-Agent: header value
- *
- * Revision 1.18 2001/07/13 14:02:46 oes
- * - Included fix to repair broken HTTP requests that
- * don't contain a path, not even '/'.
- * - Removed all #ifdef PCRS
- * - content_type now always inspected and classified as
- * text, gif or other.
- * - formatting / comments
- *
- * Revision 1.17 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.16 2001/06/29 13:32:42 oes
- * - Fixed a comment
- * - Adapted free_http_request
- * - Removed logentry from cancelled commit
- *
- * Revision 1.15 2001/06/03 19:12:38 oes
- * deleted const struct interceptors
- *
- * Revision 1.14 2001/06/01 18:49:17 jongfoster
- * Replaced "list_share" with "list" - the tiny memory gain was not
- * worth the extra complexity.
- *
- * Revision 1.13 2001/05/31 21:30:33 jongfoster
- * Removed list code - it's now in list.[ch]
- * Renamed "permission" to "action", and changed many features
- * to use the actions file rather than the global config.
- *
- * Revision 1.12 2001/05/31 17:33:13 oes
- *
- * CRLF -> LF
- *
- * Revision 1.11 2001/05/29 20:11:19 joergs
- * '/ * inside comment' warning removed.
- *
- * Revision 1.10 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.9 2001/05/28 17:26:33 jongfoster
- * Fixing segfault if last header was crunched.
- * Fixing Windows build (snprintf() is _snprintf() under Win32, but we
- * can use the cross-platform sprintf() instead.)
- *
- * Revision 1.8 2001/05/27 22:17:04 oes
- *
- * - re_process_buffer no longer writes the modified buffer
- * to the client, which was very ugly. It now returns the
- * buffer, which it is then written by chat.
- *
- * - content_length now adjusts the Content-Length: header
- * for modified documents rather than crunch()ing it.
- * (Length info in csp->content_length, which is 0 for
- * unmodified documents)
- *
- * - For this to work, sed() is called twice when filtering.
- *
- * Revision 1.7 2001/05/27 13:19:06 oes
- * Patched Joergs solution for the content-length in.
- *
- * Revision 1.6 2001/05/26 13:39:32 jongfoster
- * Only crunches Content-Length header if applying RE filtering.
- * Without this fix, Microsoft Windows Update wouldn't work.
- *
- * 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
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.3 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.2 2001/05/17 23:02:36 oes
- * - Made referrer option accept 'L' as a substitute for '§'
- *
- * Revision 1.1.1.1 2001/05/15 13:59:01 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef PARSERS_H_INCLUDED
#define PARSERS_H_INCLUDED
-#define PARSERS_H_VERSION "$Id: parsers.h,v 1.48 2008/05/30 15:57:23 fabiankeil Exp $"
+#define PARSERS_H_VERSION "$Id: parsers.h,v 1.49 2009/03/13 14:10:07 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: parsers.h,v $
- * Revision 1.48 2008/05/30 15:57:23 fabiankeil
- * Remove now-useless reference to debug.
- *
- * Revision 1.47 2008/05/21 20:12:11 fabiankeil
- * The whole point of strclean() is to modify the
- * first parameter, so don't mark it immutable,
- * even though the compiler lets us get away with it.
- *
- * Revision 1.46 2008/05/21 15:47:14 fabiankeil
- * Streamline sed()'s prototype and declare
- * the header parse and add structures static.
- *
- * Revision 1.45 2008/05/20 20:13:30 fabiankeil
- * Factor update_server_headers() out of sed(), ditch the
- * first_run hack and make server_patterns_light static.
- *
- * Revision 1.44 2008/05/20 16:05:09 fabiankeil
- * Move parsers structure definition from project.h to parsers.h.
- *
- * Revision 1.43 2008/05/10 13:23:38 fabiankeil
- * Don't provide get_header() with the whole client state
- * structure when it only needs access to csp->iob.
- *
- * Revision 1.42 2008/04/17 14:40:49 fabiankeil
- * Provide get_http_time() with the buffer size so it doesn't
- * have to blindly assume that the buffer is big enough.
- *
- * Revision 1.41 2008/04/16 16:38:21 fabiankeil
- * Don't pass the whole csp structure to flush_socket()
- * when it only needs a file descriptor and a buffer.
- *
- * Revision 1.40 2007/08/11 14:47:26 fabiankeil
- * Remove the prototypes for functions that are only
- * used in parsers.c and thus should be static.
- *
- * Revision 1.39 2007/06/01 16:31:55 fabiankeil
- * Change sed() to return a jb_err in preparation for forward-override{}.
- *
- * Revision 1.38 2007/03/25 14:27:11 fabiankeil
- * Let parse_header_time() return a jb_err code
- * instead of a pointer that can only be used to
- * check for NULL anyway.
- *
- * Revision 1.37 2007/03/20 15:22:17 fabiankeil
- * - Remove filter_client_header() and filter_client_header(),
- * filter_header() now checks the shiny new
- * CSP_FLAG_CLIENT_HEADER_PARSING_DONE flag instead.
- *
- * Revision 1.36 2007/03/05 13:25:32 fabiankeil
- * - Cosmetical changes for LOG_LEVEL_RE_FILTER messages.
- * - Handle "Cookie:" and "Connection:" headers a bit smarter
- * (don't crunch them just to recreate them later on).
- * - Add another non-standard time format for the cookie
- * expiration date detection.
- * - Fix a valgrind warning.
- *
- * Revision 1.35 2007/01/01 19:36:37 fabiankeil
- * Integrate a modified version of Wil Mahan's
- * zlib patch (PR #895531).
- *
- * Revision 1.34 2006/12/29 19:08:22 fabiankeil
- * Reverted parts of my last commit
- * to keep error handling working.
- *
- * Revision 1.33 2006/12/29 18:04:40 fabiankeil
- * Fixed gcc43 conversion warnings.
- *
- * Revision 1.32 2006/12/06 19:14:23 fabiankeil
- * Added prototype for get_destination_from_headers().
- *
- * Revision 1.31 2006/08/17 17:15:10 fabiankeil
- * - Back to timegm() using GnuPG's replacement if necessary.
- * Using mktime() and localtime() could add a on hour offset if
- * the randomize factor was big enough to lead to a summer/wintertime
- * switch.
- *
- * - Removed now-useless Privoxy 3.0.3 compatibility glue.
- *
- * - Moved randomization code into pick_from_range().
- *
- * - Changed parse_header_time definition.
- * time_t isn't guaranteed to be signed and
- * if it isn't, -1 isn't available as error code.
- * Changed some variable types in client_if_modified_since()
- * because of the same reason.
- *
- * Revision 1.30 2006/08/14 08:25:19 fabiankeil
- * Split filter-headers{} into filter-client-headers{}
- * and filter-server-headers{}.
- * Added parse_header_time() to share some code.
- * Replaced timegm() with mktime().
- *
- * Revision 1.29 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.28 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.26.2.1 2002/09/25 14:52:46 oes
- * Added basic support for OPTIONS and TRACE HTTP methods:
- * - New parser function client_max_forwards which decrements
- * the Max-Forwards HTTP header field of OPTIONS and TRACE
- * requests by one before forwarding
- * - New parser function client_host which extracts the host
- * and port information from the HTTP header field if the
- * request URI was not absolute
- * - Don't crumble and re-add the Host: header, but only generate
- * and append if missing
- *
- * Revision 1.26 2002/05/08 15:59:53 oes
- * Changed add_to_iob signature (now returns jb_err)
- *
- * Revision 1.25 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.24 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.23 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.22 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.21 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.20 2002/02/20 23:15:13 jongfoster
- * Parsing functions now handle out-of-memory gracefully by returning
- * an error code.
- *
- * Revision 1.19 2002/01/17 21:03:47 jongfoster
- * Moving all our URL and URL pattern parsing code to urlmatch.c.
- *
- * Revision 1.18 2001/10/26 17:40:23 oes
- * Introduced get_header_value()
- * Removed client_accept()
- *
- * Revision 1.17 2001/10/13 12:47:32 joergs
- * Removed client_host, added client_host_adder
- *
- * Revision 1.16 2001/10/07 18:50:16 oes
- * Added server_content_encoding, renamed server_transfer_encoding
- *
- * Revision 1.15 2001/10/07 18:01:55 oes
- * Changed server_http11 to server_http
- *
- * Revision 1.14 2001/10/07 15:45:48 oes
- * added client_accept_encoding, client_te, client_accept_encoding_adder
- *
- * renamed content_type and content_length
- *
- * fixed client_host and strclean prototypes
- *
- * Revision 1.13 2001/09/29 12:56:03 joergs
- * IJB now changes HTTP/1.1 to HTTP/1.0 in requests and answers.
- *
- * Revision 1.12 2001/09/13 23:05:50 jongfoster
- * Changing the string paramater to the header parsers a "const".
- *
- * Revision 1.11 2001/07/31 14:46:53 oes
- * Added prototype for connection_close_adder
- *
- * Revision 1.10 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.9 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.8 2001/07/13 14:01:54 oes
- * Removed all #ifdef PCRS
- *
- * Revision 1.7 2001/06/29 13:32:14 oes
- * Removed logentry from cancelled commit
- *
- * Revision 1.6 2001/06/03 19:12:38 oes
- * deleted const struct interceptors
- *
- * Revision 1.5 2001/05/31 21:30:33 jongfoster
- * Removed list code - it's now in list.[ch]
- * Renamed "permission" to "action", and changed many features
- * to use the actions file rather than the global config.
- *
- * Revision 1.4 2001/05/27 13:19:06 oes
- * Patched Joergs solution for the content-length in.
- *
- * Revision 1.3 2001/05/26 13:39:32 jongfoster
- * Only crunches Content-Length header if applying RE filtering.
- * Without this fix, Microsoft Windows Update wouldn't work.
- *
- * 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
- *
- *
*********************************************************************/
-\f
+
#include "project.h"
-const char pcrs_rcs[] = "$Id: pcrs.c,v 1.28 2007/08/18 14:37:27 fabiankeil Exp $";
+const char pcrs_rcs[] = "$Id: pcrs.c,v 1.29 2007/09/22 16:17:19 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/pcrs.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: pcrs.c,v $
- * Revision 1.28 2007/08/18 14:37:27 fabiankeil
- * Ditch hex_to_byte() in favour of xtoi().
- *
- * Revision 1.27 2007/08/05 13:47:04 fabiankeil
- * #1763173 from Stefan Huehner: s@const static@static const@.
- *
- * Revision 1.26 2007/07/01 13:29:54 fabiankeil
- * Add limited hex notation support for the PCRS
- * substitution text ('\x7e' = '~'). Closes #1627140.
- *
- * Revision 1.25 2007/04/30 15:02:18 fabiankeil
- * Introduce dynamic pcrs jobs that can resolve variables.
- *
- * Revision 1.24 2007/01/05 15:46:12 fabiankeil
- * Don't use strlen() to calculate the length of
- * the pcrs substitutes. They don't have to be valid C
- * strings and getting their length wrong can result in
- * user-controlled memory corruption.
- *
- * Thanks to Felix Gröbert for reporting the problem
- * and providing the fix [#1627140].
- *
- * Revision 1.23 2006/12/29 17:53:05 fabiankeil
- * Fixed gcc43 conversion warnings.
- *
- * Revision 1.22 2006/12/24 17:34:20 fabiankeil
- * Add pcrs_strerror() message for PCRE_ERROR_MATCHLIMIT
- * and give a hint why an error code might be unknown.
- *
- * Catch NULL subjects early in pcrs_execute().
- *
- * Revision 1.21 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.19.2.4 2005/05/07 21:50:55 david__schmidt
- * A few memory leaks plugged (mostly on error paths)
- *
- * Revision 1.19.2.3 2003/12/04 12:32:45 oes
- * Append a trailing nullbyte to result to facilitate string processing
- *
- * Revision 1.19.2.2 2002/10/08 16:22:28 oes
- * Bugfix: Need to check validity of backreferences explicitly,
- * because when max_matches are reached and matches is expanded,
- * realloc() does not zero the memory. Fixes Bug # 606227
- *
- * Revision 1.19.2.1 2002/08/10 11:23:40 oes
- * Include prce.h via project.h, where the appropriate
- * source will have been selected
- *
- * Revision 1.19 2002/03/08 14:47:48 oes
- * Cosmetics
- *
- * Revision 1.18 2002/03/08 14:17:14 oes
- * Fixing -Wconversion warnings
- *
- * Revision 1.17 2002/03/08 13:45:48 oes
- * Hiding internal functions
- *
- * Revision 1.16 2001/11/30 21:32:14 jongfoster
- * Fixing signed/unsigned comparison (Andreas please check this!)
- * One tab->space
- *
- * Revision 1.15 2001/09/20 16:11:06 steudten
- *
- * Add casting for some string functions.
- *
- * Revision 1.14 2001/09/09 21:41:57 oes
- * Fixing yet another silly bug
- *
- * Revision 1.13 2001/09/06 14:05:59 oes
- * Fixed silly bug
- *
- * Revision 1.12 2001/08/18 11:35:00 oes
- * - Introduced pcrs_strerror()
- * - made some NULL arguments non-fatal
- * - added support for \n \r \e \b \t \f \a \0 in substitute
- * - made quoting adhere to standard rules
- * - added warning for bad backrefs
- * - added pcrs_execute_list()
- * - fixed comments
- * - bugfix & cosmetics
- *
- * Revision 1.11 2001/08/15 15:32:03 oes
- * - Added support for Perl's special variables $+, $' and $`
- * - Improved the substitute parser
- * - Replaced the hard limit for the maximum number of matches
- * by dynamic reallocation
- *
- * Revision 1.10 2001/08/05 13:13:11 jongfoster
- * Making parameters "const" where possible.
- *
- * Revision 1.9 2001/07/18 17:27:00 oes
- * Changed interface; Cosmetics
- *
- * Revision 1.8 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.7 2001/06/29 13:33:04 oes
- * - Cleaned up, renamed and reordered functions,
- * improved comments
- * - Removed my_strsep
- * - Replaced globalflag with a general flags int
- * that holds PCRS_GLOBAL, PCRS_SUCCESS, and PCRS_TRIVIAL
- * - Introduced trivial option that will prevent pcrs
- * from honouring backreferences in the substitute,
- * which is useful for large substitutes that are
- * red in from somewhere and saves the pain of escaping
- * the backrefs
- * - Introduced convenience function pcrs_free_joblist()
- * - Split pcrs_make_job() into pcrs_compile(), which still
- * takes a complete s/// comand as argument and parses it,
- * and a new function pcrs_make_job, which takes the
- * three separate components. This should make for a
- * much friendlier frontend.
- * - Removed create_pcrs_job() which was useless
- * - Fixed a bug in pcrs_execute
- * - Success flag is now handled by pcrs instead of user
- *
- * Revision 1.6 2001/06/03 19:12:45 oes
- * added FIXME
- *
- * Revision 1.5 2001/05/29 09:50:24 jongfoster
- * (Fixed one int -> size_t)
- *
- * Revision 1.4 2001/05/25 14:12:40 oes
- * Fixed bug: Empty substitutes now detected
- *
- * Revision 1.3 2001/05/25 11:03:55 oes
- * Added sanity check for NULL jobs to pcrs_exec_substitution
- *
- * Revision 1.2 2001/05/22 18:46:04 oes
- *
- * Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * Revision 1.1.1.1 2001/05/15 13:59:02 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include <string.h>
#include <ctype.h>
*
* Copyright : see pcrs.c
*
- * Revisions :
- * $Log: pcrs.h,v $
- * Revision 1.15 2007/01/05 15:46:12 fabiankeil
- * Don't use strlen() to calculate the length of
- * the pcrs substitutes. They don't have to be valid C
- * strings and getting their length wrong can result in
- * user-controlled memory corruption.
- *
- * Thanks to Felix Gröbert for reporting the problem
- * and providing the fix [#1627140].
- *
- * Revision 1.14 2006/12/24 17:27:37 fabiankeil
- * Increase pcrs error code offset to prevent overlaps
- * with pcre versions newer than our own.
- *
- * Revision 1.13 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.11 2002/03/08 14:18:23 oes
- * Fixing -Wconversion warnings
- *
- * Revision 1.10 2002/03/08 13:44:48 oes
- * Hiding internal functions, preventing double inclusion of pcre.h
- *
- * Revision 1.9 2001/08/18 11:35:29 oes
- * - Introduced pcrs_strerror()
- * - added pcrs_execute_list()
- *
- * Revision 1.8 2001/08/15 15:32:50 oes
- * Replaced the hard limit for the maximum number of matches
- * by dynamic reallocation
- *
- * Revision 1.7 2001/08/05 13:13:11 jongfoster
- * Making parameters "const" where possible.
- *
- * Revision 1.6 2001/07/29 18:52:06 jongfoster
- * Renaming _PCRS_H, and adding "extern C {}"
- *
- * Revision 1.5 2001/07/18 17:27:00 oes
- * Changed interface; Cosmetics
- *
- * Revision 1.4 2001/06/29 13:33:19 oes
- * - Cleaned up, commented and adapted to reflect the
- * changes in pcrs.c
- * - Introduced the PCRS_* flags
- *
- * Revision 1.3 2001/06/09 10:58:57 jongfoster
- * Removing a single unused #define which referenced BUFSIZ
- *
- * Revision 1.2 2001/05/25 11:03:55 oes
- * Added sanity check for NULL jobs to pcrs_exec_substitution
- *
- * Revision 1.1.1.1 2001/05/15 13:59:02 oes
- * Initial import of version 2.9.3 source tree
- *
- * Revision 1.4 2001/05/11 01:57:02 rodney
- * Added new file header standard w/RCS control tags.
- *
- * revision 1.3 2001/05/08 02:38:13 rodney
- * Changed C++ "//" style comment to C style comments.
- *
- * revision 1.2 2001/04/30 02:39:24 rodney
- * Made this pcrs.h file conditionally included.
- *
- * revision 1.1 2001/04/16 21:10:38 rodney
- * Initial checkin
- *
*********************************************************************/
-#define PCRS_H_VERSION "$Id: pcrs.h,v 1.15 2007/01/05 15:46:12 fabiankeil Exp $"
-\f
+#define PCRS_H_VERSION "$Id: pcrs.h,v 1.16 2007/04/30 15:02:19 fabiankeil Exp $"
+
#ifndef _PCRE_H
#include <pcre.h>
# has notable differences from bash. By design, this script does not try to do
# too much, so as to be as cross-platform as possible.
#
-#
-# Revisions :
-# $Log: privoxy-generic.init,v $
-# Revision 1.7 2006/10/14 14:12:22 fabiankeil
-# Print warnings if the user tries to run Privoxy as root
-# or if the script is run without root privileges;
-# only use "--user" if run with root privileges and
-# don't depend on $USER being set to root. Fixes BR 779781.
-#
-# Apparently $USER isn't set on all systems,
-# but it also didn't work if the user only
-# increased her privileges with su or sudo,
-# but still had her real uid in $USER.
-#
-# Thanks to Florian Effenberger for reporting.
-#
-# Revision 1.6 2006/07/18 14:48:47 david__schmidt
-# Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
-# with what was really the latest development (the v_3_0_branch branch)
-#
-# Revision 1.5.2.1 2002/10/17 17:04:22 hal9
-# Add from main trunk. Will be needed for make install.
-#
-# Revision 1.5 2002/10/17 17:01:29 hal9
-# Set paths to match the defaults for a root install. Force remove PIDFILE on
-# stop.
-#
-# Revision 1.4 2002/09/11 01:15:02 hal9
-# Fix typo in variable. Now tested on Solaris and Linux, with defaults.
-#
-# Revision 1.3 2002/09/11 01:09:14 hal9
-# Better handling of pidfile, and process owner.
-#
-# Revision 1.2 2002/09/08 20:27:58 hal9
-# -Rewrote script config section.
-# -Added comments to script.
-# -Tried to add logic to use a --user privoxy, if available.
-# -Minor script changes due to 'echo -n' does not work on a true
-# /bin/sh system.
-#
-# Revision 1.1 2002/09/06 00:20:26 hal9
-# Creating a generic init script, meant to be used on platforms where don't have
-# a custom init script.
-#
-# Revision 1.0 2002/09/05 17:14:32 hal9
-#
#######################################################################
# Is this needed by Solaris?
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: privoxy.init,v $
-# Revision 1.8.2.3 2002/12/10 20:52:16 kick_
-# better service description. This text will be shown when the user configures the services
-#
-# Revision 1.8.2.2 2002/08/05 08:42:13 kick_
-# same permissions, same runlevels as all the other initscripts
-#
-# Revision 1.8.2.1 2002/07/12 09:14:26 kick_
-# don't use ghost files for rcX.d/*, chkconfig is available to do this job. Enable translation of error messge
-#
-# Revision 1.8 2002/04/09 02:51:31 hal9
-# Changed $JB to $PRIVOXY.
-#
-# Revision 1.7 2002/04/08 14:54:51 morcego
-# Moved the chkconfig comments to the begining of the file, couse Linuxconf
-# was getting confused with it where it was.
-#
-# Revision 1.6 2002/03/26 22:29:55 swa
-# we have a new homepage!
-#
-# Revision 1.5 2002/03/25 06:14:18 morcego
-# Removing the OPRG definition (no longer needed)
-#
-# Revision 1.4 2002/03/25 04:16:48 hal9
-# Fix proper config file location.
-#
-# Revision 1.3 2002/03/24 19:12:15 hal9
-# Fixed some naming conflicts.
-#
-# Revision 1.2 2002/03/24 11:40:14 swa
-# name change
-#
-# Revision 1.1 2002/03/24 11:23:44 swa
-# name change
-#
-# Revision 1.1 2002/03/22 20:53:03 morcego
-# - Ongoing process to change name to JunkbusterNG
-# - configure/configure.in: no change needed
-# - GNUmakefile.in:
-# - TAR_ARCH = /tmp/JunkbusterNG-$(RPM_VERSION).tar.gz
-# - PROGRAM = jbng@EXEEXT@
-# - rh-spec now references as junkbusterng-rh.spec
-# - redhat-upload: references changed to junkbusterng-* (package names)
-# - tarball-dist: references changed to JunkbusterNG-distribution-*
-# - tarball-src: now JunkbusterNG-*
-# - install: initscript now junkbusterng.init and junkbusterng (when
-# installed)
-# - junkbuster-rh.spec: renamed to junkbusterng-rh.spec
-# - junkbusterng.spec:
-# - References to the expression ijb where changed where possible
-# - New package name: junkbusterng (all in lower case, acording to
-# the LSB recomendation)
-# - Version changed to: 2.9.13
-# - Release: 1
-# - Added: junkbuster to obsoletes and conflicts (Not sure this is
-# right. If it obsoletes, why conflict ? Have to check it later)
-# - Summary changed: Stefan, please check and aprove it
-# - Changes description to use the new name
-# - Sed string was NOT changed. Have to wait to the manpage to
-# change first
-# - Keeping the user junkbuster for now. It will require some aditional
-# changes on the script (scheduled for the next specfile release)
-# - Added post entry to move the old logfile to the new log directory
-# - Removing "chkconfig --add" entry (not good to have it automaticaly
-# added to the startup list).
-# - Added preun section to stop the service with the old name, as well
-# as remove it from the startup list
-# - Removed the chkconfig --del entry from the conditional block on
-# the preun scriptlet (now handled on the %files section)
-# - junkbuster.init: renamed to junkbusterng.init
-# - junkbusterng.init:
-# - Changed JB_BIN to jbng
-# - Created JB_OBIN with the old value of JB_BIN (junkbuster), to
-# be used where necessary (config dir)
-#
-# Aditional notes:
-# - The config directory is /etc/junkbuster yet. Have to change it on the
-# specfile, after it is changes on the code
-# - The only files that got renamed on the cvs tree were the rh specfile and
-# the init file. Some file references got changes on the makefile and on the
-# rh-spec (as listed above)
-#
-# Revision 1.15 2002/03/09 15:05:58 swa
-# wrong user.group
-#
-# Revision 1.14 2002/03/06 06:13:40 hal9
-# Adapted for Andreas' changes for --user and --pidfile.
-#
-# Revision 1.13 2002/03/05 05:10:10 oes
-# Changed pidfile path to conform with FHS
-#
-# Revision 1.12 2002/03/04 20:44:36 oes
-# Changed to new cmdline syntax
-#
-# Revision 1.11 2001/12/30 14:07:32 steudten
-# - Add signal handling (unix)
-# - Add SIGHUP handler (unix)
-# - Add creation of pidfile (unix)
-# - Add action 'top' in rc file (RH)
-# - Add entry 'SIGNALS' to manpage
-# - Add exit message to logfile (unix)
-#
-# Revision 1.10 2001/11/05 21:30:23 steudten
-# Make JB startup without & due to be a 'real' daemon right now.
-# Make the script easy to change.
-#
-# Revision 1.9 2001/09/15 01:53:12 steudten
-#
-# Remove test for subsys flag in start. Some minor changes.
-#
-# Revision 1.8 2001/06/28 13:50:36 sarantis
-# swap ?$ with $?; remove bogus ";;"
-#
-# Revision 1.7 2001/06/28 13:40:26 sarantis
-# remove single quotes from $JB; it was not expanded.
-#
-# Revision 1.6 2001/06/28 13:38:42 sarantis
-# formatting changes; individual return values are returned from the init script.
-#
-# Revision 1.5 2001/06/11 11:37:40 sarantis
-# Minor editing changes.
-#
-# Revision 1.4 2001/06/09 09:14:11 swa
-# shamelessly adapted RPM stuff from the newest rpm that
-# RedHat provided for the JB.
-#
-# Revision 1.3 2001/05/25 10:12:44 oes
-# Fixed default case in switch statement (# -> *)
-#
-# Revision 1.2 2001/05/24 07:52:24 swa
-# added header. removed ^M.
-#
-#
# ********************************************************************/
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: privoxy.init.suse,v $
-# Revision 1.3.2.1 2003/03/17 14:04:16 oes
-# No longer use obsolete rc.config
-#
-# Revision 1.3 2002/03/26 22:29:55 swa
-# we have a new homepage!
-#
-# Revision 1.2 2002/03/24 11:40:14 swa
-# name change
-#
-# Revision 1.1 2002/03/24 11:23:44 swa
-# name change
-#
-# Revision 1.7 2002/03/11 11:44:46 oes
-# Working in suggestions by Thorsten Kukuk <kukuk@suse.de>
-#
-# Revision 1.6 2002/03/09 14:56:34 swa
-# wrong user.group
-#
-# Revision 1.5 2002/03/08 21:39:59 oes
-# setgid to nogroup
-#
-# Revision 1.4 2002/03/05 19:54:37 oes
-# Preliminary version of SuSE 8.0-certified init script ,-)
-#
-# Revision 1.3 2002/03/05 05:28:05 oes
-# Added pidfile creation
-#
-# Revision 1.2 2001/09/10 16:25:46 swa
-# jb did not start. none of the arguments worked. fixed.
-#
-# Revision 1.1 2001/06/08 20:53:36 swa
-# use buildroot, export init to separate file (better manageability)
-#
-#
-#
# ********************************************************************/
### BEGIN INIT INFO
# Provides: privoxy
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: privoxy.logrotate,v $
-# Revision 1.4.2.1 2002/06/25 17:33:07 kick_
-# Avoid error messages if privoxy hasn't run at all and there is no logfile yet by adding missingok to the logrotate script
-#
-# Revision 1.4 2002/03/26 22:29:55 swa
-# we have a new homepage!
-#
-# Revision 1.3 2002/03/24 15:19:57 swa
-# name change related issue.
-#
-# Revision 1.2 2002/03/24 11:40:14 swa
-# name change
-#
-# Revision 1.1 2002/03/24 11:23:44 swa
-# name change
-#
-# Revision 1.7 2001/12/30 14:07:32 steudten
-# - Add signal handling (unix)
-# - Add SIGHUP handler (unix)
-# - Add creation of pidfile (unix)
-# - Add action 'top' in rc file (RH)
-# - Add entry 'SIGNALS' to manpage
-# - Add exit message to logfile (unix)
-#
-# Revision 1.6 2001/12/13 23:19:43 steudten
-# Add 'restart' of junkbuster service after rotate logfiles.
-# Better we could use the well known 'kill -HUP', but the handler
-# isn't there at this time.
-#
-# Revision 1.5 2001/11/05 21:31:51 steudten
-# Change switch mode from weekly to size 1M
-#
-# Revision 1.4 2001/06/28 13:30:22 sarantis
-# add missingok for the jarfile entry
-#
-# Revision 1.3 2001/06/04 18:31:58 swa
-# files are now prefixed with either `confdir' or `logdir'.
-# `make redhat-dist' replaces both entries confdir and logdir
-# with redhat values
-#
-# Revision 1.2 2001/05/24 07:52:24 swa
-# added header. removed ^M.
-#
-# Revision 1.3 2001/05/24 07:41:33 swa
-# added header
-#
-#
-#
# ********************************************************************/
/var/log/privoxy/logfile {
#ifndef PROJECT_H_INCLUDED
#define PROJECT_H_INCLUDED
/** Version string. */
-#define PROJECT_H_VERSION "$Id: project.h,v 1.136 2009/05/13 18:20:54 fabiankeil Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.137 2009/05/13 18:22:45 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/project.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: project.h,v $
- * Revision 1.136 2009/05/13 18:20:54 fabiankeil
- * There's no reason for keep_alive_timeout to be signed.
- *
- * Revision 1.135 2009/05/10 10:19:23 fabiankeil
- * Reenable server-side-only keep-alive support, but only share
- * outgoing connections if the connection-sharing option is set.
- *
- * Revision 1.134 2009/05/10 10:12:30 fabiankeil
- * Initial keep-alive support for the client socket.
- * Temporarily disable the server-side-only keep-alive code.
- *
- * Revision 1.133 2009/04/24 15:29:43 fabiankeil
- * Allow to limit the number of of client connections.
- *
- * Revision 1.132 2009/04/17 11:45:19 fabiankeil
- * Replace HAVE_GETADDRINFO and HAVE_GETNAMEINFO macros
- * with HAVE_RFC2553 macro. Original patch by Petr Pisar.
- *
- * Revision 1.131 2009/04/17 11:34:35 fabiankeil
- * Style cosmetics for the IPv6 code.
- *
- * Revision 1.130 2009/04/17 11:27:49 fabiankeil
- * Petr Pisar's privoxy-3.0.12-ipv6-3.diff.
- *
- * Revision 1.129 2009/03/08 14:12:51 fabiankeil
- * All the CSP_FLAG_FOO bit masks should be unsigned ints.
- *
- * Revision 1.128 2009/03/07 13:09:17 fabiankeil
- * Change csp->expected_content and_csp->expected_content_length from
- * size_t to unsigned long long to reduce the likelihood of integer
- * overflows that would let us close the connection prematurely.
- * Bug found while investigating #2669131, reported by cyberpatrol.
- *
- * Revision 1.127 2008/12/20 14:53:55 fabiankeil
- * Add config option socket-timeout to control the time
- * Privoxy waits for data to arrive on a socket. Useful
- * in case of stale ssh tunnels or when fuzz-testing.
- *
- * Revision 1.126 2008/12/14 17:02:54 fabiankeil
- * Fix a cparser warning.
- *
- * Revision 1.125 2008/11/20 08:22:28 fabiankeil
- * Remove an obsolete comment.
- *
- * Revision 1.124 2008/11/16 12:43:49 fabiankeil
- * Turn keep-alive support into a runtime feature
- * that is disabled by setting keep-alive-timeout
- * to a negative value.
- *
- * Revision 1.123 2008/11/10 16:55:59 fabiankeil
- * Fix a gcc44 warning (in filters.c).
- *
- * Revision 1.122 2008/10/16 07:11:34 fabiankeil
- * Fix a bunch of gcc44 conversion warnings.
- *
- * Revision 1.121 2008/10/09 18:21:41 fabiankeil
- * Flush work-in-progress changes to keep outgoing connections
- * alive where possible. Incomplete and mostly #ifdef'd out.
- *
- * Revision 1.120 2008/09/21 13:36:52 fabiankeil
- * If change-x-forwarded-for{add} is used and the client
- * sends multiple X-Forwarded-For headers, append the client's
- * IP address to each one of them. "Traditionally" we would
- * lose all but the last one.
- *
- * Revision 1.119 2008/09/20 10:04:33 fabiankeil
- * Remove hide-forwarded-for-headers action which has
- * been obsoleted by change-x-forwarded-for{block}.
- *
- * Revision 1.118 2008/09/19 15:26:29 fabiankeil
- * Add change-x-forwarded-for{} action to block or add
- * X-Forwarded-For headers. Mostly based on code removed
- * before 3.0.7.
- *
- * Revision 1.117 2008/08/30 12:03:07 fabiankeil
- * Remove FEATURE_COOKIE_JAR.
- *
- * Revision 1.116 2008/05/20 16:05:02 fabiankeil
- * Move parsers structure definition from project.h to parsers.h.
- *
- * Revision 1.115 2008/05/19 16:57:20 fabiankeil
- * Declare all members of the parsers structure immutable.
- *
- * Revision 1.114 2008/04/11 16:35:39 fabiankeil
- * Oops, I forgot to shorten the URL_SPEC_INITIALIZER in my last commit.
- *
- * Revision 1.113 2008/04/10 14:41:04 fabiankeil
- * Ditch url_spec's path member now that it's no longer used.
- *
- * Revision 1.112 2008/04/06 15:18:34 fabiankeil
- * Oh well, rename the --enable-pcre-host-patterns option to
- * --enable-extended-host-patterns as it's not really PCRE syntax.
- *
- * Revision 1.111 2008/04/06 14:54:26 fabiankeil
- * Use PCRE syntax in host patterns when configured
- * with --enable-pcre-host-patterns.
- *
- * Revision 1.110 2008/03/29 12:13:46 fabiankeil
- * Remove send-wafer and send-vanilla-wafer actions.
- *
- * Revision 1.109 2008/03/28 15:13:41 fabiankeil
- * Remove inspect-jpegs action.
- *
- * Revision 1.108 2008/03/27 18:27:36 fabiankeil
- * Remove kill-popups action.
- *
- * Revision 1.107 2008/03/26 18:07:08 fabiankeil
- * Add hostname directive. Closes PR#1918189.
- *
- * Revision 1.106 2008/03/24 11:21:03 fabiankeil
- * Share the action settings for multiple patterns in the same
- * section so we waste less memory for gigantic block lists
- * (and load them slightly faster). Reported by Franz Schwartau.
- *
- * Revision 1.105 2008/03/21 11:16:27 fabiankeil
- * Garbage-collect csp->my_ip_addr_str and csp->my_hostname.
- *
- * Revision 1.104 2008/03/04 18:30:40 fabiankeil
- * Remove the treat-forbidden-connects-like-blocks action. We now
- * use the "blocked" page for forbidden CONNECT requests by default.
- *
- * Revision 1.103 2008/03/01 14:00:45 fabiankeil
- * Let the block action take the reason for the block
- * as argument and show it on the "blocked" page.
- *
- * Revision 1.102 2008/02/03 13:46:14 fabiankeil
- * Add SOCKS5 support. Patch #1862863 by Eric M. Hopper with minor changes.
- *
- * Revision 1.101 2007/12/07 18:29:23 fabiankeil
- * Remove now-obsolete csp member x_forwarded.
- *
- * Revision 1.100 2007/09/02 13:42:11 fabiankeil
- * - Allow port lists in url patterns.
- * - Ditch unused url_spec member pathlen.
- *
- * Revision 1.99 2007/07/21 11:51:36 fabiankeil
- * As Hal noticed, checking dispatch_cgi() as the last cruncher
- * looks like a bug if CGI requests are blocked unintentionally,
- * so don't do it unless the user enabled the new config option
- * "allow-cgi-request-crunching".
- *
- * Revision 1.98 2007/07/14 07:31:26 fabiankeil
- * Add new csp->content_type flag (CT_DECLARED).
- *
- * Revision 1.97 2007/05/27 12:38:08 fabiankeil
- * - Remove some left-overs from the switch to dedicated header filters.
- * - Adjust "X-Filter: No" to disable dedicated header filters.
- * - Prepare for forward-override{}
- *
- * Revision 1.96 2007/05/14 10:41:15 fabiankeil
- * Ditch the csp member cookie_list[] which isn't used anymore.
- *
- * Revision 1.95 2007/04/30 15:02:19 fabiankeil
- * Introduce dynamic pcrs jobs that can resolve variables.
- *
- * Revision 1.94 2007/04/15 16:39:21 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.93 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.92 2007/03/17 15:20:05 fabiankeil
- * New config option: enforce-blocks.
- *
- * Revision 1.91 2007/03/05 13:28:03 fabiankeil
- * Add some CSP_FLAGs for the header parsers.
- *
- * Revision 1.90 2007/02/07 10:36:16 fabiankeil
- * Add new http_response member to save
- * the reason why the response was generated.
- *
- * Revision 1.89 2007/01/27 13:09:16 fabiankeil
- * Add new config option "templdir" to
- * change the templates directory.
- *
- * Revision 1.88 2007/01/25 13:36:59 fabiankeil
- * Add csp->error_message for failure reasons
- * that should be embedded into the CGI pages.
- *
- * Revision 1.87 2007/01/01 19:36:37 fabiankeil
- * Integrate a modified version of Wil Mahan's
- * zlib patch (PR #895531).
- *
- * Revision 1.86 2006/12/31 17:56:37 fabiankeil
- * Added config option accept-intercepted-requests
- * and disabled it by default.
- *
- * Revision 1.85 2006/12/31 15:03:31 fabiankeil
- * Fix gcc43 compiler warnings and a comment.
- *
- * Revision 1.84 2006/12/21 12:57:48 fabiankeil
- * Add config option "split-large-forms"
- * to work around the browser bug reported
- * in BR #1570678.
- *
- * Revision 1.83 2006/12/06 19:26:29 fabiankeil
- * Moved HTTP snipplets into jcc.c. They aren't
- * used anywhere else.
- *
- * Revision 1.82 2006/09/20 15:50:31 fabiankeil
- * Doubled size of HOSTENT_BUFFER_SIZE to mask
- * problems with gethostbyname_r and some
- * /etc/hosts configurations. Only a workaround
- * until we get the real fix ready.
- * Thanks Félix Rauch for reporting.
- *
- * Increased value of MAX_TRUSTED_REFERRERS from 64 to 512.
- *
- * Revision 1.81 2006/09/06 13:03:04 fabiankeil
- * Respond with 400 and a short text message
- * if the client tries to use Privoxy as FTP proxy.
- *
- * Revision 1.80 2006/09/06 10:43:32 fabiankeil
- * Added config option enable-remote-http-toggle
- * to specify if Privoxy should recognize special
- * headers (currently only X-Filter) to change its
- * behaviour. Disabled by default.
- *
- * Revision 1.79 2006/09/06 09:23:37 fabiankeil
- * Make number of retries in case of forwarded-connect problems
- * a config file option (forwarded-connect-retries) and use 0 as
- * default.
- *
- * Revision 1.78 2006/08/31 16:25:06 fabiankeil
- * Work around a buffer overflow that caused Privoxy to
- * segfault if too many trusted referrers were used. Good
- * enough for now, but should be replaced with a real
- * solution after the next release.
- *
- * Revision 1.77 2006/08/21 12:50:51 david__schmidt
- * Formatting cleanup
- *
- * Revision 1.76 2006/08/14 08:25:19 fabiankeil
- * Split filter-headers{} into filter-client-headers{}
- * and filter-server-headers{}.
- * Added parse_header_time() to share some code.
- * Replaced timegm() with mktime().
- *
- * Revision 1.75 2006/08/03 02:46:41 david__schmidt
- * Incorporate Fabian Keil's patch work:\r * http://www.fabiankeil.de/sourcecode/privoxy/
- *
- * Revision 1.74 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.72.2.7 2006/01/29 23:10:56 david__schmidt
- * Multiple filter file support
- *
- * Revision 1.72.2.6 2004/10/03 12:53:46 david__schmidt
- * Add the ability to check jpeg images for invalid
- * lengths of comment blocks. Defensive strategy
- * against the exploit:
- * Microsoft Security Bulletin MS04-028
- * Buffer Overrun in JPEG Processing (GDI+) Could
- * Allow Code Execution (833987)
- * Enabled with +inspect-jpegs in actions files.
- *
- * Revision 1.72.2.5 2004/01/30 15:29:29 oes
- * Updated the copyright note
- *
- * Revision 1.72.2.4 2004/01/13 16:12:14 oes
- * Fixed double slash in USER_MANUAL_URL. Closes BR #867088.
- *
- * Revision 1.72.2.3 2003/03/11 11:54:37 oes
- * Introduced RC_FLAG_* flags for use in child process return code
- *
- * Revision 1.72.2.2 2002/11/28 18:15:44 oes
- * Added flag to each cgi_dispatcher that allows or denies
- * external linking and removed const qualifier from
- * struct list_entry.str.
- *
- * Revision 1.72.2.1 2002/08/10 11:25:18 oes
- * - Include config.h for access to config data
- * - Include <pcre*.h> depending on where they are
- *
- * Revision 1.72 2002/05/14 21:35:49 oes
- * Split HELP_LINK_PREFIX into ACTIONS_HELP_PREFIX and CONFIG_HELP_PREFIX
- * because of split in user-manual
- *
- * Revision 1.71 2002/05/12 21:39:36 jongfoster
- * - Adding Doxygen-style comments to structures and #defines.
- *
- * Revision 1.70 2002/05/12 16:05:50 jongfoster
- * Fixing ACTION_MASK_ALL to be unsigned long rather than
- * just unsigned int. I don't know if anyone is porting
- * Privoxy to 16-bit platforms, but if so, +limit-connect
- * wouldn't have worked because of this bug.
- *
- * Revision 1.69 2002/05/08 16:00:16 oes
- * Added size member to struct iob, so it can
- * be alloced larger than needed.
- *
- * Revision 1.68 2002/04/26 12:56:00 oes
- * Killed REDIRECT_URL, added USER_MANUAL_URL and HELP_LINK_PREFIX
- *
- * Revision 1.67 2002/04/24 02:12:43 oes
- * - Jon's multiple AF patch:
- * - Make csp->actions_list an array
- * - #define MAX_AF_FILES
- * - Moved CGI_PARAM_LEN_MAX (500) here
- *
- * Revision 1.66 2002/04/15 19:06:43 jongfoster
- * Typos
- *
- * Revision 1.65 2002/04/04 00:36:36 gliptak
- * always use pcre for matching
- *
- * Revision 1.64 2002/04/03 22:28:03 gliptak
- * Removed references to gnu_regex
- *
- * Revision 1.63 2002/03/31 17:19:00 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.62 2002/03/26 22:48:49 swa
- * new homepage url
- *
- * Revision 1.61 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.60 2002/03/24 15:52:17 jongfoster
- * Changing CGI URL prefixes for new name
- *
- * Revision 1.59 2002/03/24 15:23:33 jongfoster
- * Name changes
- *
- * Revision 1.58 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.57 2002/03/16 20:28:34 oes
- * Added descriptions to the filters so users will know what they select in the cgi editor
- *
- * Revision 1.56 2002/03/13 20:27:30 oes
- * Fixing bug with CT_TABOO
- *
- * Revision 1.55 2002/03/12 01:42:50 oes
- * Introduced modular filters
- *
- * Revision 1.54 2002/03/09 20:03:52 jongfoster
- * - Making various functions return int rather than size_t.
- * (Undoing a recent change). Since size_t is unsigned on
- * Windows, functions like read_socket that return -1 on
- * error cannot return a size_t.
- *
- * THIS WAS A MAJOR BUG - it caused frequent, unpredictable
- * crashes, and also frequently caused JB to jump to 100%
- * CPU and stay there. (Because it thought it had just
- * read ((unsigned)-1) == 4Gb of data...)
- *
- * - The signature of write_socket has changed, it now simply
- * returns success=0/failure=nonzero.
- *
- * - Trying to get rid of a few warnings --with-debug on
- * Windows, I've introduced a new type "jb_socket". This is
- * used for the socket file descriptors. On Windows, this
- * is SOCKET (a typedef for unsigned). Everywhere else, it's
- * an int. The error value can't be -1 any more, so it's
- * now JB_INVALID_SOCKET (which is -1 on UNIX, and in
- * Windows it maps to the #define INVALID_SOCKET.)
- *
- * - The signature of bind_port has changed.
- *
- * Revision 1.53 2002/03/08 16:48:55 oes
- * Added FEATURE_NO_GIFS and BUILTIN_IMAGE_MIMETYPE
- *
- * Revision 1.52 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.51 2002/03/05 04:52:42 oes
- * Deleted non-errlog debugging code
- *
- * Revision 1.50 2002/03/04 19:32:07 oes
- * Changed default port to 8118
- *
- * Revision 1.49 2002/03/04 18:28:55 oes
- * Deleted PID_FILE_NAME
- *
- * Revision 1.48 2002/03/03 14:50:40 oes
- * Fixed CLF logging: Added ocmd member for client's request to struct http_request
- *
- * Revision 1.47 2002/02/20 23:15:13 jongfoster
- * Parsing functions now handle out-of-memory gracefully by returning
- * an error code.
- *
- * Revision 1.46 2002/01/17 21:06:09 jongfoster
- * Now #defining the URLs of the config interface
- *
- * Minor changes to struct http_request and struct url_spec due to
- * standardizing that struct http_request is used to represent a URL, and
- * struct url_spec is used to represent a URL pattern. (Before, URLs were
- * represented as seperate variables and a partially-filled-in url_spec).
- *
- * Revision 1.45 2002/01/09 14:33:27 oes
- * Added HOSTENT_BUFFER_SIZE
- *
- * Revision 1.44 2001/12/30 14:07:32 steudten
- * - Add signal handling (unix)
- * - Add SIGHUP handler (unix)
- * - Add creation of pidfile (unix)
- * - Add action 'top' in rc file (RH)
- * - Add entry 'SIGNALS' to manpage
- * - Add exit message to logfile (unix)
- *
- * Revision 1.43 2001/11/22 21:57:51 jongfoster
- * Making action_spec->flags into an unsigned long rather than just an
- * unsigned int.
- * Adding ACTION_NO_COOKIE_KEEP
- *
- * Revision 1.42 2001/11/05 21:42:41 steudten
- * Include DBG() macro.
- *
- * Revision 1.41 2001/10/28 19:12:06 jongfoster
- * Adding ijb_toupper()
- *
- * Revision 1.40 2001/10/26 17:40:47 oes
- * Moved ijb_isspace and ijb_tolower to project.h
- * Removed http->user_agent, csp->referrer and csp->accept_types
- *
- * Revision 1.39 2001/10/25 03:45:02 david__schmidt
- * Adding a (void*) cast to freez() because Visual Age C++ won't expand the
- * macro when called with a cast; so moving the cast to the macro def'n
- * seems to both eliminate compiler warnings (on darwin and OS/2, anyway) and
- * doesn't make macro expansion complain. Hope this works for everyone else
- * too...
- *
- * Revision 1.38 2001/10/23 21:19:04 jongfoster
- * New error-handling support: jb_err type and JB_ERR_xxx constants
- * CGI functions now return a jb_err, and their parameters map is const.
- * Support for RUNTIME_FEATUREs to enable/disable config editor
- * Adding a few comments
- *
- * Revision 1.37 2001/10/14 22:14:01 jongfoster
- * Removing name_length field from struct cgi_dispatcher, as this is
- * now calculated at runtime from the "name" field.
- *
- * Revision 1.36 2001/10/10 16:45:15 oes
- * Added LIMIT_CONNECT action and string
- * Fixed HTTP message line termination
- * Added CFORBIDDEN HTTP message
- *
- * Revision 1.35 2001/10/07 18:06:43 oes
- * Added status member to struct http_request
- *
- * Revision 1.34 2001/10/07 15:45:25 oes
- * Added url member to struct http_request and commented all
- * members
- *
- * Added CT_TABOO
- *
- * Added ACTION_DOWNGRADE and ACTION_NO_COMPRESSION
- *
- * Replaced struct client_state members rejected,
- * force, active and toggled_on with "flags" bitmap.
- *
- * Added CSP_FLAG_MODIFIED and CSP_FLAG_CHUNKED
- *
- * Added buffer_limit to struct configuration_spec
- *
- * Revision 1.33 2001/09/20 13:30:08 steudten
- *
- * Make freez() more secure in case of: if (exp) { free(z) ; a=*z }
- * Last case will set z to NULL in free(z) and thats bad..
- *
- * Revision 1.32 2001/09/16 23:02:51 jongfoster
- * Fixing warning
- *
- * Revision 1.31 2001/09/16 13:20:29 jongfoster
- * Rewrite of list library. Now has seperate header and list_entry
- * structures. Also added a large sprinking of assert()s to the list
- * code.
- *
- * Revision 1.30 2001/09/13 23:52:00 jongfoster
- * Support for both static and dynamically generated CGI pages
- *
- * Revision 1.29 2001/09/13 23:29:43 jongfoster
- * Defining FORWARD_SPEC_INITIALIZER
- *
- * Revision 1.28 2001/09/13 23:05:50 jongfoster
- * Changing the string paramater to the header parsers a "const".
- *
- * Revision 1.27 2001/08/05 16:06:20 jongfoster
- * Modifiying "struct map" so that there are now separate header and
- * "map_entry" structures. This means that functions which modify a
- * map no longer need to return a pointer to the modified map.
- * Also, it no longer reverses the order of the entries (which may be
- * important with some advanced template substitutions).
- *
- * Revision 1.26 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.25 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.24 2001/07/25 17:20:27 oes
- * Introduced http->user_agent
- *
- * Revision 1.23 2001/07/18 12:32:23 oes
- * - Added ACTION_STRING_DEANIMATE
- * - moved #define freez from jcc.h to project.h
- *
- * Revision 1.22 2001/07/15 17:51:41 jongfoster
- * Renaming #define STATIC to STATIC_PCRE
- *
- * Revision 1.21 2001/07/13 14:03:19 oes
- * - Reorganized regex header inclusion and #defines to
- * comply to the scheme in configure.in
- * - Added csp->content_type and its CT_* keys
- * - Added ACTION_DEANIMATE
- * - Removed all #ifdef PCRS
- *
- * Revision 1.20 2001/06/29 21:45:41 oes
- * Indentation, CRLF->LF, Tab-> Space
- *
- * Revision 1.19 2001/06/29 13:33:36 oes
- * - Improved comments
- * - Introduced http_request.host_ip_addr_str
- * - Introduced http_response.head_length
- * - Introduced config.my_ip_addr_str, config.my_hostname,
- * config.admin_address and config.proxy_info_url
- * - Removed config.proxy_args_header and config.proxy_args_trailer,
- * renamed config.proxy_args_invocation to config.proxy_args
- * - Removed HTML snipplets and GIFs
- * - Removed logentry from cancelled commit
- *
- * Revision 1.18 2001/06/09 10:57:39 jongfoster
- * Adding definition of BUFFER_SIZE.
- * Changing struct cgi_dispatcher to use "const" strings.
- *
- * Revision 1.17 2001/06/07 23:15:09 jongfoster
- * Merging ACL and forward files into config file.
- * Moving struct gateway members into struct forward_spec
- * Removing config->proxy_args_gateways
- * Cosmetic: Adding a few comments
- *
- * Revision 1.16 2001/06/04 18:31:58 swa
- * files are now prefixed with either `confdir' or `logdir'.
- * `make redhat-dist' replaces both entries confdir and logdir
- * with redhat values
- *
- * Revision 1.15 2001/06/04 11:28:53 swa
- * redirect did not work due to missing /
- *
- * Revision 1.14 2001/06/03 11:03:48 oes
- * Added struct map,
- * added struct http_response,
- * changed struct interceptors to struct cgi_dispatcher,
- * moved HTML stuff to cgi.h
- *
- * Revision 1.13 2001/06/01 20:05:36 jongfoster
- * Support for +image-blocker{}: added ACTION_IMAGE_BLOCKER
- * constant, and removed csp->tinygif.
- *
- * Revision 1.12 2001/06/01 18:49:17 jongfoster
- * Replaced "list_share" with "list" - the tiny memory gain was not
- * worth the extra complexity.
- *
- * Revision 1.11 2001/06/01 10:32:47 oes
- * Added constants for anchoring selection bitmap
- *
- * Revision 1.10 2001/05/31 21:33:53 jongfoster
- * Changes for new actions file, replacing permissionsfile
- * and parts of the config file. Also added support for
- * list_shared.
- *
- * Revision 1.9 2001/05/31 17:32:31 oes
- *
- * - Enhanced domain part globbing with infix and prefix asterisk
- * matching and optional unanchored operation
- *
- * Revision 1.8 2001/05/29 20:09:15 joergs
- * HTTP_REDIRECT_TEMPLATE fixed.
- *
- * Revision 1.7 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/actionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.6 2001/05/27 22:17:04 oes
- *
- * - re_process_buffer no longer writes the modified buffer
- * to the client, which was very ugly. It now returns the
- * buffer, which it is then written by chat.
- *
- * - content_length now adjusts the Content-Length: header
- * for modified documents rather than crunch()ing it.
- * (Length info in csp->content_length, which is 0 for
- * unmodified documents)
- *
- * - For this to work, sed() is called twice when filtering.
- *
- * 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
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Some minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.3 2001/05/20 01:21:20 jongfoster
- * Version 2.9.4 checkin.
- * - Merged popupfile and cookiefile, and added control over PCRS
- * filtering, in new "actionsfile".
- * - 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.2 2001/05/17 23:01:01 oes
- * - Cleaned CRLF's from the sources and related files
- *
- * Revision 1.1.1.1 2001/05/15 13:59:03 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
/* Declare struct FILE for vars and funcs. */
#include <stdio.h>
-const char ssplit_rcs[] = "$Id: ssplit.c,v 1.8 2006/07/18 14:48:47 david__schmidt Exp $";
+const char ssplit_rcs[] = "$Id: ssplit.c,v 1.9 2007/11/03 14:35:45 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/ssplit.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: ssplit.c,v $
- * Revision 1.8 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.6 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.5 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.4 2001/11/13 00:16:38 jongfoster
- * Replacing references to malloc.h with the standard stdlib.h
- * (See ANSI or K&R 2nd Ed)
- *
- * Revision 1.3 2001/05/29 08:54:25 jongfoster
- * Rewrote the innards of ssplit() to be easier to understand,
- * faster, and to use less memory. Didn't change the interface
- * except to give the parameters meaningful names.
- *
- * Revision 1.2 2001/05/17 23:01:01 oes
- * - Cleaned CRLF's from the sources and related files
- *
- * Revision 1.1.1.1 2001/05/15 13:59:04 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef SSPLIT_H_INCLUDED
#define SSPLIT_H_INCLUDED
-#define SSPLIT_H_VERSION "$Id: ssplit.h,v 1.5 2002/03/26 22:29:55 swa Exp $"
+#define SSPLIT_H_VERSION "$Id: ssplit.h,v 1.7 2006/07/18 14:48:47 david__schmidt Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/Attic/ssplit.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/ssplit.h,v $
*
* Purpose : A function to split a string at specified deliminters.
*
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: ssplit.h,v $
- * Revision 1.5 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.4 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.3 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.2 2001/05/29 08:54:25 jongfoster
- * Rewrote the innards of ssplit() to be easier to understand,
- * faster, and to use less memory. Didn't change the interface
- * except to give the parameters meaningful names.
- *
- * Revision 1.1.1.1 2001/05/15 13:59:04 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: cgi-style.css,v $
-# Revision 1.11 2007/12/08 14:29:06 fabiankeil
-# Use CSS to let the URL and pattern input fields scale with
-# the browser width and try to prevent vertical scroll bars
-# if the width is less than 80 characters. Closes #1843596,
-# thanks to Gerry Murphy and Lee.
-#
-# Revision 1.10 2007/01/22 13:12:43 fabiankeil
-# White space cosmetics for #include.
-#
-# Revision 1.9 2006/12/17 17:50:55 fabiankeil
-# Add white space workaround for tables
-# in show-status CGI page.
-#
-# Revision 1.8 2002/05/12 15:53:41 jongfoster
-# Adding standard comment header with license and CVS log.
-#
-#
##############################################################################
/*
* CSS for Privoxy CGI and script output
*
- * $Id: cgi-style.css,v 1.11 2007/12/08 14:29:06 fabiankeil Exp $
+ * $Id: cgi-style.css,v 1.12 2007/12/11 21:20:53 fabiankeil Exp $
*/
/*
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: edit-actions-add-url-form,v $
-# Revision 1.17 2007/01/23 16:03:16 fabiankeil
-# - Add favicon links.
-# - Remove useless W3C validator links.
-#
-# Revision 1.16 2006/07/18 14:49:13 david__schmidt
-# Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
-# with what was really the latest development (the v_3_0_branch branch)
-#
-# Revision 1.14.2.2 2002/08/23 02:22:53 hal9
-# Fix a perl brain fart with <li> in comments.
-#
-# Revision 1.14 2002/05/21 19:10:30 oes
-# - Added jump target and button style to "cancel" link
-# - Fixed title
-#
-# Revision 1.13 2002/04/10 13:32:53 oes
-# Made templates modular
-#
-# Revision 1.12 2002/04/08 17:08:14 oes
-# Cosmetic: make status in title lowercase
-#
-# Revision 1.11 2002/04/05 16:01:33 oes
-# Correct HTML, external Stylesheets, eye candy, some fixes
-#
-# Revision 1.10 2002/03/26 22:29:56 swa
-# we have a new homepage!
-#
-# Revision 1.9 2002/03/24 15:23:33 jongfoster
-# Name changes
-#
-# Revision 1.8 2002/03/24 11:01:06 swa
-# name change
-#
-# Revision 1.7 2002/03/23 16:18:15 swa
-# renamed every reference to the old name with foobar.
-# fixed "application foobar application" tag, fixed
-# "the foobar" with "foobar". left junkbuster in cvs
-# comments and remarks to history untouched. should
-# make final rename easier.
-#
-# Revision 1.6 2002/03/16 15:22:19 jongfoster
-# Moving 'alpha' warning to the end of the page
-#
-# Revision 1.5 2002/03/03 10:29:12 swa
-# point users to the right feedback forms,
-# not necessarily the developer list.
-#
-# Revision 1.4 2002/01/23 00:26:45 jongfoster
-# Reducing length of URLs
-# Where encoded and unencoded versions of a string existed, removing
-# the unencoded one.
-#
-# Revision 1.3 2002/01/17 21:33:00 jongfoster
-# Replacing all references to the URL of the config interface
-# with @default-cgi@
-#
-# Revision 1.2 2002/01/17 21:21:03 jongfoster
-# DOS->Unix line endings
-#
-# Revision 1.1 2001/11/13 00:58:18 jongfoster
-# New version of actions file editor templates
-#
-#
##############################################################################
#
# Standard support:
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: edit-actions-for-url,v $
-# Revision 1.55 2008/09/19 15:26:29 fabiankeil
-# Add change-x-forwarded-for{} action to block or add
-# X-Forwarded-For headers. Mostly based on code removed
-# before 3.0.7.
-#
-# Revision 1.54 2008/03/29 12:14:27 fabiankeil
-# Remove send-wafer and send-vanilla-wafer actions.
-#
-# Revision 1.53 2008/03/28 15:13:45 fabiankeil
-# Remove inspect-jpegs action.
-#
-# Revision 1.52 2008/03/15 14:52:36 fabiankeil
-# Add CGI editor support for the "disable all filters of this type"
-# directives "-client-header-filter", "-server-header-filter",
-# "-client-header-tagger" and "-server-header-tagger".
-#
-# Revision 1.51 2008/03/07 16:46:49 fabiankeil
-# Reword limit-connect{} entry.
-#
-# Revision 1.50 2008/03/04 18:30:44 fabiankeil
-# Remove the treat-forbidden-connects-like-blocks action. We now
-# use the "blocked" page for forbidden CONNECT requests by default.
-#
-# Revision 1.49 2008/03/01 14:00:47 fabiankeil
-# Let the block action take the reason for the block
-# as argument and show it on the "blocked" page.
-#
-# Revision 1.48 2007/12/11 21:18:55 fabiankeil
-# Make forward-override accessible through the CGI editor.
-#
-# Revision 1.47 2007/12/06 18:21:55 fabiankeil
-# Update hide-forwarded-for-headers description.
-#
-# Revision 1.46 2007/11/10 15:06:10 fabiankeil
-# - Add support for +hide-referrer{conditional-forge}.
-# - Minor rewordings.
-#
-# Revision 1.45 2007/05/24 13:38:45 fabiankeil
-# Two minor fixes.
-#
-# Revision 1.44 2007/04/15 16:39:21 fabiankeil
-# Introduce tags as alternative way to specify which
-# actions apply to a request. At the moment tags can be
-# created based on client and server headers.
-#
-# Revision 1.43 2007/03/29 11:40:34 fabiankeil
-# Divide @filter-params@ into @client-header-filter-params@
-# @content-filter-params@ and @server-header-filter-params@.
-#
-# 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.
-#
-# Revision 1.40 2006/12/21 13:01:03 fabiankeil
-# Prepare for "split-large-forms".
-#
-# Mention that redirect{} now also understands
-# a single pcrs job as argument.
-#
-# Add some table summaries and remove useless validator link.
-#
-# Revision 1.39 2006/10/04 17:37:54 fabiankeil
-# JavaScript fix for bug report #1570678.
-#
-# Revision 1.38 2006/09/08 12:06:35 fabiankeil
-# Have hide-if-modified-since interpret the random
-# range value as minutes instead of hours. Allows
-# more fine-grained configuration.
-#
-# Revision 1.37 2006/09/05 18:20:14 fabiankeil
-# Sorted alphabetically, fixed spelling mistakes
-# and shortened some descriptions.
-#
-# Revision 1.36 2006/08/14 08:29:17 fabiankeil
-# Split filter-headers{} into filter-client-headers{}
-# and filter-server-headers{}.
-#
-# Revision 1.35 2006/08/03 02:46:42 david__schmidt
-# Incorporate Fabian Keil's patch work:\rhttp://www.fabiankeil.de/sourcecode/privoxy/
-#
-# Revision 1.34 2006/07/18 14:49:13 david__schmidt
-# Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
-# with what was really the latest development (the v_3_0_branch branch)
-#
-# Revision 1.29.2.5 2004/10/05 03:17:26 david__schmidt
-# Typo: inspect_jpegs, not inspect-jpegs in form
-#
-# Revision 1.29.2.4 2004/10/03 12:53:46 david__schmidt
-# Add the ability to check jpeg images for invalid
-# lengths of comment blocks. Defensive strategy
-# against the exploit:
-# Microsoft Security Bulletin MS04-028
-# Buffer Overrun in JPEG Processing (GDI+) Could
-# Allow Code Execution (833987)
-# Enabled with +inspect-jpegs in actions files.
-#
-# Revision 1.29.2.3 2002/08/23 02:22:53 hal9
-# Fix a perl brain fart with <li> in comments.
-#
-# Revision 1.29.2.1 2002/08/02 12:51:42 oes
-# Added top submit button; Consistency with docs: Change default name for action from hide-referer to hide-referrer
-#
-# Revision 1.29 2002/05/21 19:10:57 oes
-# Fixed JavaScript error
-#
-# Revision 1.28 2002/05/14 21:36:38 oes
-# - Renamed prevent-(setting/reading)-cookies to
-# crunch-(incoming/outgoing)-cookies
-# - Renamed helplink export to actions-help-prefix
-# - Restored alphabetical order of actions
-#
-# Revision 1.27 2002/04/26 22:55:26 jongfoster
-# Removing the alternating colors because they've been wrong
-# since the actions renames, they're high maintenance, they
-# don't look particularly good, and now there are gaps between
-# the table cells we don't need them.
-#
-# Revision 1.26 2002/04/26 21:55:17 jongfoster
-# Cosmetic change: Making the +filter UI look the same as
-# the other actions.
-#
-# Revision 1.25 2002/04/26 21:37:50 jongfoster
-# Fixing all(?) the substitutions that were broken in the
-# recent actions rename.
-#
-# Revision 1.24 2002/04/26 18:24:28 jongfoster
-# Fixing typos in help hyperlinks
-#
-# Revision 1.23 2002/04/26 12:57:02 oes
-# Actions renamed, alphabetically sorted, comments fixed, and names linked to help
-#
-# Revision 1.22 2002/04/10 13:32:53 oes
-# Made templates modular
-#
-# Revision 1.21 2002/04/08 17:05:18 oes
-# Inline a style exception
-#
-# Revision 1.20 2002/04/05 16:01:30 oes
-# Correct HTML, external Stylesheets, eye candy, some fixes
-#
-# Revision 1.19 2002/03/26 22:29:56 swa
-# we have a new homepage!
-#
-# Revision 1.18 2002/03/24 16:32:08 jongfoster
-# Removing logo option
-#
-# Revision 1.17 2002/03/24 15:23:33 jongfoster
-# Name changes
-#
-# Revision 1.16 2002/03/24 11:01:06 swa
-# name change
-#
-# Revision 1.15 2002/03/23 16:18:15 swa
-# renamed every reference to the old name with foobar.
-# fixed "application foobar application" tag, fixed
-# "the foobar" with "foobar". left junkbuster in cvs
-# comments and remarks to history untouched. should
-# make final rename easier.
-#
-# Revision 1.14 2002/03/16 15:22:19 jongfoster
-# Moving 'alpha' warning to the end of the page
-#
-# Revision 1.13 2002/03/16 14:28:38 jongfoster
-# First version of modular filters support
-#
-# Revision 1.12 2002/03/12 01:42:50 oes
-# Introduced modular filters
-#
-# Revision 1.11 2002/03/08 18:19:14 jongfoster
-# Adding +image-blocker{pattern} option to edit interface
-#
-# Revision 1.10 2002/03/03 10:29:12 swa
-# point users to the right feedback forms,
-# not necessarily the developer list.
-#
-# Revision 1.9 2002/01/23 00:26:45 jongfoster
-# Reducing length of URLs
-# Where encoded and unencoded versions of a string existed, removing
-# the unencoded one.
-#
-# Revision 1.8 2002/01/17 21:33:00 jongfoster
-# Replacing all references to the URL of the config interface
-# with @default-cgi@
-#
-# Revision 1.7 2002/01/17 21:21:03 jongfoster
-# DOS->Unix line endings
-#
-# Revision 1.6 2001/11/22 21:58:41 jongfoster
-# Adding action +no-cookies-keep
-#
-# Revision 1.5 2001/11/13 21:12:17 jongfoster
-# Added support for the following actions:
-# +downgrade, +limit-connect, +no-compression
-#
-# Revision 1.4 2001/11/13 00:58:18 jongfoster
-# New version of actions file editor templates
-#
-#
##############################################################################
#
# Browser support for the JavaScript on this page:
# Foundation; either version 2 of the License, or (at
# your option) any later version.
#
-# Revisions :
-# $Log: edit-actions-for-url-filter,v $
-# Revision 1.7 2007/03/20 15:40:00 fabiankeil
-# Adjust to new world order with dedicated header-filter actions.
-#
-#
##############################################################################
<tr class="bg1" align="left" valign="top">
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: edit-actions-list,v $
-# Revision 1.33 2007/04/08 13:21:06 fabiankeil
-# Reference action files in CGI URLs by id instead
-# of using the first part of the file name.
-# Fixes BR 1694250 and BR 1590556.
-#
-# Revision 1.32 2007/01/23 16:03:16 fabiankeil
-# - Add favicon links.
-# - Remove useless W3C validator links.
-#
-# Revision 1.31 2006/09/10 14:39:24 hal9
-# Fix typo + minor change.
-#
-# Revision 1.30 2006/09/09 01:12:15 hal9
-# Soften actions files update interval.
-#
-# Revision 1.29 2006/07/18 14:49:13 david__schmidt
-# Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
-# with what was really the latest development (the v_3_0_branch branch)
-#
-# Revision 1.26.2.4 2003/12/17 16:35:17 oes
-# Work around new & silly MSIE behaviour where the request resulting from
-# changing window.location.href doesn't reveal the referrer anymore
-#
-# Revision 1.26.2.3 2002/09/25 15:34:09 oes
-# - Work around JS problem in NS 2.0 (no joke)
-# - Make JS string edit popup remove the pattern
-# if edited to empty; make JS add popup do nothing
-# if pattern empty.
-#
-# Revision 1.26.2.2 2002/08/23 02:22:53 hal9
-# Fix a perl brain fart with <li> in comments.
-#
-# Revision 1.26 2002/05/23 23:37:25 oes
-# Nit
-#
-# Revision 1.25 2002/05/21 21:02:52 oes
-# Added more help links
-#
-# Revision 1.24 2002/05/21 19:11:40 oes
-# - Added client-side JavaScript versions of edit and add URL forms
-# - Moved jump targets to before container table cell
-# - Let earu determine the jump target when removing URLs via JS
-# - Fixed broken help link
-#
-# Revision 1.23 2002/05/12 15:53:10 jongfoster
-# Restoring CVS log information accidentally removed in
-# my previous commit.
-#
-# Revision 1.22 2002/05/12 15:45:33 jongfoster
-# Applying [Patch 552094] New templates for edit-actions-list
-# This cleans up the templates by:
-# - Removing the (confusing) alternating color scheme.
-# - Making everything left-justified.
-#
-# Revision 1.21 2002/05/03 22:58:15 jongfoster
-# Fixing link target in all URLs section
-#
-# Revision 1.20 2002/04/26 12:57:18 oes
-# - Central "button" link style in cgi-style.css
-# - Help links now dynamic
-#
-# Revision 1.19 2002/04/24 02:19:16 oes
-# - Show name of actions file being edited
-# - Show context sensitive help
-# - Add buttons for easy changing of defaults
-# - Cosmetics and clarifications
-#
-# Revision 1.18 2002/04/18 19:21:09 jongfoster
-# Added code to detect "conventional" action files, that start
-# with a set of actions for all URLs (the pattern "/").
-# These are special-cased in the "edit-actions-list" CGI, so
-# that a special UI can be written for them.
-#
-# Revision 1.17 2002/04/10 13:32:53 oes
-# Made templates modular
-#
-# Revision 1.16 2002/04/08 17:08:14 oes
-# Cosmetic: make status in title lowercase
-#
-# Revision 1.15 2002/04/05 16:01:32 oes
-# Correct HTML, external Stylesheets, eye candy, some fixes
-#
-# Revision 1.14 2002/03/26 22:29:56 swa
-# we have a new homepage!
-#
-# Revision 1.13 2002/03/24 15:23:33 jongfoster
-# Name changes
-#
-# Revision 1.12 2002/03/24 11:01:06 swa
-# name change
-#
-# Revision 1.11 2002/03/23 16:18:15 swa
-# renamed every reference to the old name with foobar.
-# fixed "application foobar application" tag, fixed
-# "the foobar" with "foobar". left junkbuster in cvs
-# comments and remarks to history untouched. should
-# make final rename easier.
-#
-# Revision 1.10 2002/03/16 15:22:19 jongfoster
-# Moving 'alpha' warning to the end of the page
-#
-# Revision 1.9 2002/03/05 00:24:51 jongfoster
-# Patch to always edit the current actions file.
-#
-# Revision 1.8 2002/03/03 10:29:12 swa
-# point users to the right feedback forms,
-# not necessarily the developer list.
-#
-# Revision 1.7 2002/01/23 00:26:45 jongfoster
-# Reducing length of URLs
-# Where encoded and unencoded versions of a string existed, removing
-# the unencoded one.
-#
-# Revision 1.6 2002/01/17 21:33:00 jongfoster
-# Replacing all references to the URL of the config interface
-# with @default-cgi@
-#
-# Revision 1.5 2002/01/17 21:21:05 jongfoster
-# DOS->Unix line endings
-#
-# Revision 1.4 2001/11/13 00:58:18 jongfoster
-# New version of actions file editor templates
-#
-#
##############################################################################
#
# Browser support for the CSS on this page:
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: edit-actions-list-button,v $
-# Revision 1.2 2002/05/12 15:45:33 jongfoster
-# Applying [Patch 552094] New templates for edit-actions-list
-# This cleans up the templates by:
-# - Removing the (confusing) alternating color scheme.
-# - Making everything left-justified.
-#
-# Revision 1.1 2002/05/03 23:00:38 jongfoster
-# Support for templates for "standard actions" buttons.
-# See bug #549871
-#
#############################################################################
<a href="eas?f=@f@&v=@v@&s=@all-urls-s@&p=@button-name@#l@all-urls-s@">Set to @button-name@</a>
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: edit-actions-list-section,v $
-# Revision 1.15.2.1 2003/12/17 16:35:17 oes
-# Work around new & silly MSIE behaviour where the request resulting from
-# changing window.location.href doesn't reveal the referrer anymore
-#
-# Revision 1.15 2002/05/21 21:02:52 oes
-# Added more help links
-#
-# Revision 1.14 2002/05/21 19:12:43 oes
-# - Added client-side JavaScript versions of edit and add URL forms
-# - Moved jump targets to before container table cell
-#
-# Revision 1.13 2002/05/12 15:45:33 jongfoster
-# Applying [Patch 552094] New templates for edit-actions-list
-# This cleans up the templates by:
-# - Removing the (confusing) alternating color scheme.
-# - Making everything left-justified.
-#
-# Revision 1.12 2002/04/26 12:58:11 oes
-# Central "button" link style in cgi-style.css
-#
-# Revision 1.11 2002/04/24 02:14:03 oes
-# Changed shortcuts, Cosmetics
-#
-# Revision 1.10 2002/04/17 21:27:26 jongfoster
-# Adding #linenumber to the URLs which affect blocks, to make
-# editing in long files easier.
-#
-# Revision 1.9 2002/04/17 15:51:47 oes
-# Args! Restoring CVS history
-#
-# Revision 1.8 2002/04/17 15:04:16 oes
-# Adapted to style change
-#
-# Revision 1.7 2002/03/26 22:29:56 swa
-# we have a new homepage!
-#
-# Revision 1.6 2002/03/24 11:01:06 swa
-# name change
-#
-# Revision 1.5 2002/01/23 00:26:45 jongfoster
-# Reducing length of URLs
-# Where encoded and unencoded versions of a string existed, removing
-# the unencoded one.
-#
-# Revision 1.4 2002/01/17 21:33:00 jongfoster
-# Replacing all references to the URL of the config interface
-# with @default-cgi@
-#
-# Revision 1.3 2001/11/13 00:58:18 jongfoster
-# New version of actions file editor templates
-#
-#
#############################################################################
#
# Available variables include:
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: edit-actions-list-url,v $
-# Revision 1.10.2.1 2003/12/17 16:35:17 oes
-# Work around new & silly MSIE behaviour where the request resulting from
-# changing window.location.href doesn't reveal the referrer anymore
-#
-# Revision 1.10 2002/05/21 19:13:14 oes
-# Added client-side JavaScript versions of edit and add URL forms
-#
-# Revision 1.9 2002/05/12 15:45:33 jongfoster
-# Applying [Patch 552094] New templates for edit-actions-list
-# This cleans up the templates by:
-# - Removing the (confusing) alternating color scheme.
-# - Making everything left-justified.
-#
-# Revision 1.8 2002/04/26 12:58:11 oes
-# Central "button" link style in cgi-style.css
-#
-# Revision 1.7 2002/03/26 22:29:56 swa
-# we have a new homepage!
-#
-# Revision 1.6 2002/03/24 11:01:06 swa
-# name change
-#
-# Revision 1.5 2002/01/23 00:26:45 jongfoster
-# Reducing length of URLs
-# Where encoded and unencoded versions of a string existed, removing
-# the unencoded one.
-#
-# Revision 1.4 2002/01/17 21:33:00 jongfoster
-# Replacing all references to the URL of the config interface
-# with @default-cgi@
-#
-# Revision 1.3 2001/11/13 00:58:18 jongfoster
-# New version of actions file editor templates
-#
-#
#############################################################################
#
# Available variables include:
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: edit-actions-remove-url-form,v $
-# Revision 1.16 2006/07/18 14:49:14 david__schmidt
-# Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
-# with what was really the latest development (the v_3_0_branch branch)
-#
-# Revision 1.14.2.2 2002/08/23 02:22:53 hal9
-# Fix a perl brain fart with <li> in comments.
-#
-# Revision 1.14 2002/05/21 19:13:49 oes
-# Added button style and jumptargets to "add" and "cancel" links
-#
-# Revision 1.13 2002/04/10 13:32:53 oes
-# Made templates modular
-#
-# Revision 1.12 2002/04/08 17:08:14 oes
-# Cosmetic: make status in title lowercase
-#
-# Revision 1.11 2002/04/05 16:01:30 oes
-# Correct HTML, external Stylesheets, eye candy, some fixes
-#
-# Revision 1.10 2002/03/26 22:29:56 swa
-# we have a new homepage!
-#
-# Revision 1.9 2002/03/24 15:23:33 jongfoster
-# Name changes
-#
-# Revision 1.8 2002/03/24 11:01:06 swa
-# name change
-#
-# Revision 1.7 2002/03/23 16:18:15 swa
-# renamed every reference to the old name with foobar.
-# fixed "application foobar application" tag, fixed
-# "the foobar" with "foobar". left junkbuster in cvs
-# comments and remarks to history untouched. should
-# make final rename easier.
-#
-# Revision 1.6 2002/03/16 15:22:19 jongfoster
-# Moving 'alpha' warning to the end of the page
-#
-# Revision 1.5 2002/03/03 10:29:12 swa
-# point users to the right feedback forms,
-# not necessarily the developer list.
-#
-# Revision 1.4 2002/01/23 00:26:45 jongfoster
-# Reducing length of URLs
-# Where encoded and unencoded versions of a string existed, removing
-# the unencoded one.
-#
-# Revision 1.3 2002/01/17 21:33:00 jongfoster
-# Replacing all references to the URL of the config interface
-# with @default-cgi@
-#
-# Revision 1.2 2002/01/17 21:21:05 jongfoster
-# DOS->Unix line endings
-#
-# Revision 1.1 2001/11/13 00:58:18 jongfoster
-# New version of actions file editor templates
-#
-#
##############################################################################
#
# Standard support:
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: edit-actions-url-form,v $
-# Revision 1.17 2007/01/23 16:03:16 fabiankeil
-# - Add favicon links.
-# - Remove useless W3C validator links.
-#
-# Revision 1.16 2006/07/18 14:49:14 david__schmidt
-# Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
-# with what was really the latest development (the v_3_0_branch branch)
-#
-# Revision 1.14.2.2 2002/08/23 02:22:53 hal9
-# Fix a perl brain fart with <li> in comments.
-#
-# Revision 1.14 2002/05/21 19:14:10 oes
-# Added button style and jumptarget "cancel" link
-#
-# Revision 1.13 2002/04/10 13:32:53 oes
-# Made templates modular
-#
-# Revision 1.12 2002/04/08 17:08:14 oes
-# Cosmetic: make status in title lowercase
-#
-# Revision 1.11 2002/04/05 16:01:32 oes
-# Correct HTML, external Stylesheets, eye candy, some fixes
-#
-# Revision 1.10 2002/03/26 22:29:56 swa
-# we have a new homepage!
-#
-# Revision 1.9 2002/03/24 15:23:33 jongfoster
-# Name changes
-#
-# Revision 1.8 2002/03/24 11:01:06 swa
-# name change
-#
-# Revision 1.7 2002/03/23 16:18:15 swa
-# renamed every reference to the old name with foobar.
-# fixed "application foobar application" tag, fixed
-# "the foobar" with "foobar". left junkbuster in cvs
-# comments and remarks to history untouched. should
-# make final rename easier.
-#
-# Revision 1.6 2002/03/16 15:22:19 jongfoster
-# Moving 'alpha' warning to the end of the page
-#
-# Revision 1.5 2002/03/03 10:29:13 swa
-# point users to the right feedback forms,
-# not necessarily the developer list.
-#
-# Revision 1.4 2002/01/23 00:26:45 jongfoster
-# Reducing length of URLs
-# Where encoded and unencoded versions of a string existed, removing
-# the unencoded one.
-#
-# Revision 1.3 2002/01/17 21:33:00 jongfoster
-# Replacing all references to the URL of the config interface
-# with @default-cgi@
-#
-# Revision 1.2 2002/01/17 21:21:05 jongfoster
-# DOS->Unix line endings
-#
-# Revision 1.1 2001/11/13 00:58:18 jongfoster
-# New version of actions file editor templates
-#
-#
##############################################################################
#
# Standard support:
# Foundation; either version 2 of the License, or (at
# your option) any later version.
#
-# Revisions :
-# $Log: mod-support-and-service,v $
-# Revision 1.10 2007/03/17 11:31:36 fabiankeil
-# - Add revision log and copyright header.
-# - Reword instructions and link to the FAQ
-# in an attempt to reduce the number of
-# incomplete reports.
-#
##############################################################################
<h2>Support and Service:</h2>
<p>
# or write to the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# Revisions :
-# $Log: show-url-info,v $
-# Revision 1.28 2009/01/01 14:51:21 ler762
-# keep the input field and 'go' button on the same line.
-#
-# Revision 1.27 2008/05/26 17:30:58 fabiankeil
-# Provide an OpenSearch Description to access the
-# show-url-info page through "search engine plugins".
-#
-# Revision 1.26 2008/05/05 10:03:06 fabiankeil
-# If the provided URL isn't valid, don't show the
-# cgi-editor-is-disabled and filters-might-be-ineffective
-# sections.
-#
-# Revision 1.25 2008/04/26 10:34:18 fabiankeil
-# If zlib support is unavailable and there are content filters active
-# but the prevent-compression action is disabled, include a warning
-# on the show-url-info page that compression might prevent filtering.
-#
-# Revision 1.24 2008/02/10 17:26:52 fabiankeil
-# Reduce superfluous white space by not marking
-# up the final results list as paragraph.
-#
-# Revision 1.23 2008/02/01 06:04:31 fabiankeil
-# If edit buttons on the show-url-info CGI page are hidden, explain why.
-#
-# Revision 1.22 2007/12/08 14:29:06 fabiankeil
-# Use CSS to let the URL and pattern input fields scale with
-# the browser width and try to prevent vertical scroll bars
-# if the width is less than 80 characters. Closes #1843596,
-# thanks to Gerry Murphy and Lee.
-#
-# Revision 1.21 2007/11/15 19:11:11 fabiankeil
-# Reword HTTPS URL information.
-#
-# Revision 1.20 2007/07/21 12:19:50 fabiankeil
-# If show-url-info is called with an URL that Privoxy
-# would reject as invalid, don't show unresolved forwarding
-# variables, "final matches" or claim the site's secure.
-#
-# Revision 1.19 2007/02/10 16:55:22 fabiankeil
-# - Show forwarding settings on the show-url-info page
-# - Fix some HTML syntax errors.
-#
-#
#########################################################################
# USING HTML TEMPLATES:
# ---------------------
-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.49 2009/04/17 11:34:35 fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.50 2009/04/17 11:38:28 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: urlmatch.c,v $
- * Revision 1.49 2009/04/17 11:34:35 fabiankeil
- * Style cosmetics for the IPv6 code.
- *
- * Revision 1.48 2009/04/17 11:27:49 fabiankeil
- * Petr Pisar's privoxy-3.0.12-ipv6-3.diff.
- *
- * Revision 1.47 2009/03/02 19:18:10 fabiankeil
- * Streamline parse_http_request()'s prototype. As
- * cparser pointed out it doesn't actually use csp.
- *
- * Revision 1.46 2009/02/11 19:31:32 fabiankeil
- * Reject request lines that end with neither HTTP/1.0 nor HTTP/1.1.
- *
- * Revision 1.45 2008/06/21 21:19:18 fabiankeil
- * Silence bogus compiler warning.
- *
- * Revision 1.44 2008/05/04 16:18:32 fabiankeil
- * Provide parse_http_url() with a third parameter to specify
- * whether or not URLs without protocol are acceptable.
- *
- * Revision 1.43 2008/05/04 13:30:55 fabiankeil
- * Streamline parse_http_url()'s prototype.
- *
- * Revision 1.42 2008/05/04 13:24:16 fabiankeil
- * If the method isn't CONNECT, reject URLs without protocol.
- *
- * Revision 1.41 2008/05/02 09:51:34 fabiankeil
- * In parse_http_url(), don't muck around with values
- * that are none of its business: require an initialized
- * http structure and never unset http->ssl.
- *
- * Revision 1.40 2008/04/23 16:12:28 fabiankeil
- * Free with freez().
- *
- * Revision 1.39 2008/04/22 16:27:42 fabiankeil
- * In parse_http_request(), remove a pointless
- * temporary variable and free the buffer earlier.
- *
- * Revision 1.38 2008/04/18 05:17:18 fabiankeil
- * Mark simplematch()'s parameters as immutable.
- *
- * Revision 1.37 2008/04/17 14:53:29 fabiankeil
- * Move simplematch() into urlmatch.c as it's only
- * used to match (old-school) domain patterns.
- *
- * Revision 1.36 2008/04/14 18:19:48 fabiankeil
- * Remove now-pointless cast in create_url_spec().
- *
- * Revision 1.35 2008/04/14 18:11:21 fabiankeil
- * The compiler might not notice it, but the buffer passed to
- * create_url_spec() is modified later on and thus shouldn't
- * be declared immutable.
- *
- * Revision 1.34 2008/04/13 13:32:07 fabiankeil
- * Factor URL pattern compilation out of create_url_spec().
- *
- * Revision 1.33 2008/04/12 14:03:13 fabiankeil
- * Remove an obvious comment and improve another one.
- *
- * Revision 1.32 2008/04/12 12:38:06 fabiankeil
- * Factor out duplicated code to compile host, path and tag patterns.
- *
- * Revision 1.31 2008/04/10 14:41:04 fabiankeil
- * Ditch url_spec's path member now that it's no longer used.
- *
- * Revision 1.30 2008/04/10 04:24:24 fabiankeil
- * Stop duplicating the plain text representation of the path regex
- * (and keeping the copy around). Once the regex is compiled it's no
- * longer useful.
- *
- * Revision 1.29 2008/04/10 04:17:56 fabiankeil
- * In url_match(), check the right member for NULL when determining
- * whether there's a path regex to execute. Looking for a plain-text
- * representation works as well, but it looks "interesting" and that
- * member will be removed soonish anyway.
- *
- * Revision 1.28 2008/04/08 16:07:39 fabiankeil
- * Make it harder to mistake url_match()'s
- * second parameter for an url_spec.
- *
- * Revision 1.27 2008/04/08 15:44:33 fabiankeil
- * Save a bit of memory (and a few cpu cycles) by not bothering to
- * compile slash-only path regexes that don't affect the result.
- *
- * Revision 1.26 2008/04/07 16:57:18 fabiankeil
- * - Use free_url_spec() more consistently.
- * - Let it reset url->dcount just in case.
- *
- * Revision 1.25 2008/04/06 15:18:38 fabiankeil
- * Oh well, rename the --enable-pcre-host-patterns option to
- * --enable-extended-host-patterns as it's not really PCRE syntax.
- *
- * Revision 1.24 2008/04/06 14:54:26 fabiankeil
- * Use PCRE syntax in host patterns when configured
- * with --enable-pcre-host-patterns.
- *
- * Revision 1.23 2008/04/05 12:19:20 fabiankeil
- * Factor compile_host_pattern() out of create_url_spec().
- *
- * Revision 1.22 2008/03/30 15:02:32 fabiankeil
- * SZitify unknown_method().
- *
- * Revision 1.21 2007/12/24 16:34:23 fabiankeil
- * Band-aid (and micro-optimization) that makes it less likely to run out of
- * stack space with overly-complex path patterns. Probably masks the problem
- * reported by Lee in #1856679. Hohoho.
- *
- * Revision 1.20 2007/09/02 15:31:20 fabiankeil
- * Move match_portlist() from filter.c to urlmatch.c.
- * It's used for url matching, not for filtering.
- *
- * Revision 1.19 2007/09/02 13:42:11 fabiankeil
- * - Allow port lists in url patterns.
- * - Ditch unused url_spec member pathlen.
- *
- * Revision 1.18 2007/07/30 16:42:21 fabiankeil
- * Move the method check into unknown_method()
- * and loop through the known methods instead
- * of using a screen-long OR chain.
- *
- * Revision 1.17 2007/04/15 16:39:21 fabiankeil
- * Introduce tags as alternative way to specify which
- * actions apply to a request. At the moment tags can be
- * created based on client and server headers.
- *
- * Revision 1.16 2007/02/13 13:59:24 fabiankeil
- * Remove redundant log message.
- *
- * Revision 1.15 2007/01/28 16:11:23 fabiankeil
- * Accept WebDAV methods for subversion
- * in parse_http_request(). Closes FR 1581425.
- *
- * Revision 1.14 2007/01/06 14:23:56 fabiankeil
- * Fix gcc43 warnings. Mark *csp as immutable
- * for parse_http_url() and url_match().
- * Replace a sprintf call with snprintf.
- *
- * Revision 1.13 2006/12/06 19:50:54 fabiankeil
- * parse_http_url() now handles intercepted
- * HTTP request lines as well. Moved parts
- * of parse_http_url()'s code into
- * init_domain_components() so that it can
- * be reused in chat().
- *
- * Revision 1.12 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.10.2.7 2003/05/17 15:57:24 oes
- * - parse_http_url now checks memory allocation failure for
- * duplication of "*" URL and rejects "*something" URLs
- * Closes bug #736344
- * - Added a comment to what might look like a bug in
- * create_url_spec (see !bug #736931)
- * - Comment cosmetics
- *
- * Revision 1.10.2.6 2003/05/07 12:39:48 oes
- * Fix typo: Default port for https URLs is 443, not 143.
- * Thanks to Scott Tregear for spotting this one.
- *
- * Revision 1.10.2.5 2003/02/28 13:09:29 oes
- * Fixed a rare double free condition as per Bug #694713
- *
- * Revision 1.10.2.4 2003/02/28 12:57:44 oes
- * Moved freeing of http request structure to its owner
- * as per Dan Price's observations in Bug #694713
- *
- * Revision 1.10.2.3 2002/11/12 16:50:40 oes
- * Fixed memory leak in parse_http_request() reported by Oliver Stoeneberg. Fixes bug #637073
- *
- * Revision 1.10.2.2 2002/09/25 14:53:15 oes
- * Added basic support for OPTIONS and TRACE HTTP methods:
- * parse_http_url now recognizes the "*" URI as well as
- * the OPTIONS and TRACE method keywords.
- *
- * Revision 1.10.2.1 2002/06/06 19:06:44 jongfoster
- * Adding support for proprietary Microsoft WebDAV extensions
- *
- * Revision 1.10 2002/05/12 21:40:37 jongfoster
- * - Removing some unused code
- *
- * Revision 1.9 2002/04/04 00:36:36 gliptak
- * always use pcre for matching
- *
- * Revision 1.8 2002/04/03 23:32:47 jongfoster
- * Fixing memory leak on error
- *
- * Revision 1.7 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.6 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.5 2002/03/13 00:27:05 jongfoster
- * Killing warnings
- *
- * Revision 1.4 2002/03/07 03:46:17 oes
- * Fixed compiler warnings
- *
- * Revision 1.3 2002/03/03 14:51:11 oes
- * Fixed CLF logging: Added ocmd member for client's request to struct http_request
- *
- * Revision 1.2 2002/01/21 00:14:09 jongfoster
- * Correcting comment style
- * Fixing an uninitialized memory bug in create_url_spec()
- *
- * Revision 1.1 2002/01/17 20:53:46 jongfoster
- * Moving all our URL and URL pattern parsing code to the same file - it
- * was scattered around in filters.c, loaders.c and parsers.c.
- *
- * Providing a single, simple url_match(pattern,url) function - rather than
- * the 3-line match routine which was repeated all over the place.
- *
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Providing parse_http_url() so that URLs can be parsed without faking a
- * HTTP request line for parse_http_request() or repeating the parsing
- * code (both of which were techniques that were actually in use).
- *
- * Standardizing that struct http_request is used to represent a URL, and
- * struct url_spec is used to represent a URL pattern. (Before, URLs were
- * represented as seperate variables and a partially-filled-in url_spec).
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef URLMATCH_H_INCLUDED
#define URLMATCH_H_INCLUDED
-#define URLMATCH_H_VERSION "$Id: urlmatch.h,v 1.13 2009/03/02 19:18:11 fabiankeil Exp $"
+#define URLMATCH_H_VERSION "$Id: urlmatch.h,v 1.14 2009/04/17 11:38:28 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: urlmatch.h,v $
- * Revision 1.13 2009/03/02 19:18:11 fabiankeil
- * Streamline parse_http_request()'s prototype. As
- * cparser pointed out it doesn't actually use csp.
- *
- * Revision 1.12 2008/05/04 16:18:32 fabiankeil
- * Provide parse_http_url() with a third parameter to specify
- * whether or not URLs without protocol are acceptable.
- *
- * Revision 1.11 2008/05/04 13:30:55 fabiankeil
- * Streamline parse_http_url()'s prototype.
- *
- * Revision 1.10 2008/04/14 18:11:21 fabiankeil
- * The compiler might not notice it, but the buffer passed to
- * create_url_spec() is modified later on and thus shouldn't
- * be declared immutable.
- *
- * Revision 1.9 2008/04/08 16:07:39 fabiankeil
- * Make it harder to mistake url_match()'s
- * second parameter for an url_spec.
- *
- * Revision 1.8 2007/09/02 15:31:20 fabiankeil
- * Move match_portlist() from filter.c to urlmatch.c.
- * It's used for url matching, not for filtering.
- *
- * Revision 1.7 2007/01/06 14:24:38 fabiankeil
- * Mark *csp as immutable for parse_http_url()
- * and url_match().
- *
- * Revision 1.6 2006/12/06 19:12:43 fabiankeil
- * Added prototype for init_domain_components().
- *
- * Revision 1.5 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.3 2002/03/26 22:29:55 swa
- * we have a new homepage!
- *
- * Revision 1.2 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.1 2002/01/17 20:53:46 jongfoster
- * Moving all our URL and URL pattern parsing code to the same file - it
- * was scattered around in filters.c, loaders.c and parsers.c.
- *
- * Providing a single, simple url_match(pattern,url) function - rather than
- * the 3-line match routine which was repeated all over the place.
- *
- * Renaming free_url to free_url_spec, since it frees a struct url_spec.
- *
- * Providing parse_http_url() so that URLs can be parsed without faking a
- * HTTP request line for parse_http_request() or repeating the parsing
- * code (both of which were techniques that were actually in use).
- *
- * Standardizing that struct http_request is used to represent a URL, and
- * struct url_spec is used to represent a URL pattern. (Before, URLs were
- * represented as seperate variables and a partially-filled-in url_spec).
- *
- *
*********************************************************************/
-\f
+
#include "project.h"
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: vc_config_pthreads.h,v $
- * Revision 1.5 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.3 2002/05/03 22:54:24 jongfoster
- * Version number bump to 2.9.15
- *
- * Revision 1.2 2002/04/26 18:26:09 jongfoster
- * Bumping version numbers
- *
- * Revision 1.1 2002/04/06 20:38:01 jongfoster
- * Renaming VC++ versions of config.h
- *
- * Revision 1.20 2002/04/03 22:28:03 gliptak
- * Removed references to gnu_regex
- *
- * Revision 1.19 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.18 2002/03/24 17:08:12 jongfoster
- * Version number bump
- *
- * Revision 1.17 2002/03/24 13:33:26 swa
- * name change related issues
- *
- * Revision 1.16 2002/03/16 14:27:22 jongfoster
- * Ignoring a very common warning.
- *
- * Revision 1.15 2002/03/13 00:28:32 jongfoster
- * Hiding all the warnings generated by #include<windows.h>
- *
- * Revision 1.14 2001/11/30 21:35:54 jongfoster
- * Bumping version number to 2.9.10
- *
- * Revision 1.13 2001/10/23 21:24:09 jongfoster
- * Support for FEATURE_CGI_EDIT_ACTIONS
- *
- * Revision 1.12 2001/10/07 15:33:14 oes
- * Removed FEATURE_DENY_GZIP
- * Bumped up version number
- *
- * Revision 1.11 2001/09/16 16:59:34 jongfoster
- * Bugfix - couldn't build resources with previous version.
- *
- * Revision 1.10 2001/09/16 16:19:02 jongfoster
- * New version based on latest configure.in and acconfig.h
- *
- * Revision 1.9 2001/07/30 22:16:07 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.8 2001/07/25 19:16:27 oes
- * Bumping version number to 2.9.8
- *
- * Revision 1.7 2001/07/21 18:00:07 jongfoster
- * Bumping version number to 2.9.7
- *
- * Revision 1.6 2001/07/15 20:08:40 jongfoster
- * New build files for VC++ which provide the option of POSIX
- * or Win32 threads.
- *
- * Revision 1.5 2001/07/15 18:00:46 jongfoster
- * Renaming STATIC to STATIC_PCRE.
- * Replacing this file with one built by "configure" from
- * "config.h.in", for consistency.
- *
- * Revision 1.6 2001/07/15 17:54:29 jongfoster
- * Renaming #define STATIC to STATIC_PCRE
- * Adding new #define FEATURE_PTHREAD that will be used to enable
- * POSIX threads support.
- *
- * Revision 1.5 2001/07/13 13:48:37 oes
- * - (Fix:) Copied CODE_STATUS #define from config.h.in
- * - split REGEX #define into REGEX_GNU and REGEX_PCRE
- * and removed PCRE.
- * (REGEX = REGEX_GNU || REGEX_PCRE per project.h)
- * - Moved STATIC (for pcre) here from Makefile.in
- * - Introduced STATIC_PCRS #define to allow for dynaimc linking with
- * libpcrs
- * - Removed PCRS #define, since pcrs is now needed for CGI anyway
- *
- * Revision 1.4 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.3 2001/05/26 01:26:34 jongfoster
- * New #define, WIN_GUI_EDIT, enables the (embryonic) Win32 GUI editor.
- * This #define cannot be set from ./configure - there's no point, it
- * doesn't work yet. See feature request # 425722
- *
- * Revision 1.2 2001/05/22 17:43:35 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Many minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.1.1.1 2001/05/15 13:58:45 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
/*
* Version number - Major (X._._)
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: vc_config_winthreads.h,v $
- * Revision 1.5 2006/07/18 14:48:47 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.3.2.1 2006/04/08 21:57:26 david__schmidt
- * Synchronize with a more modern copy of config.h.
- *
- * Revision 1.3 2002/05/03 22:54:24 jongfoster
- * Version number bump to 2.9.15
- *
- * Revision 1.2 2002/04/26 18:26:09 jongfoster
- * Bumping version numbers
- *
- * Revision 1.1 2002/04/06 20:38:01 jongfoster
- * Renaming VC++ versions of config.h
- *
- * Revision 1.14 2002/03/26 22:29:54 swa
- * we have a new homepage!
- *
- * Revision 1.13 2002/03/24 17:08:12 jongfoster
- * Version number bump
- *
- * Revision 1.12 2002/03/24 13:25:43 swa
- * name change related issues
- *
- * Revision 1.11 2002/03/16 14:27:22 jongfoster
- * Ignoring a very common warning.
- *
- * Revision 1.10 2002/03/13 00:28:32 jongfoster
- * Hiding all the warnings generated by #include<windows.h>
- *
- * Revision 1.9 2001/11/30 21:35:54 jongfoster
- * Bumping version number to 2.9.10
- *
- * Revision 1.8 2001/10/23 21:24:09 jongfoster
- * Support for FEATURE_CGI_EDIT_ACTIONS
- *
- * Revision 1.7 2001/10/07 15:33:14 oes
- * Removed FEATURE_DENY_GZIP
- * Bumped up version number
- *
- * Revision 1.6 2001/09/16 16:59:34 jongfoster
- * Bugfix - couldn't build resources with previous version.
- *
- * Revision 1.5 2001/09/16 16:19:02 jongfoster
- * New version based on latest configure.in and acconfig.h
- *
- * Revision 1.9 2001/07/30 22:16:07 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.8 2001/07/25 19:16:27 oes
- * Bumping version number to 2.9.8
- *
- * Revision 1.7 2001/07/21 18:00:07 jongfoster
- * Bumping version number to 2.9.7
- *
- * Revision 1.6 2001/07/15 20:08:40 jongfoster
- * New build files for VC++ which provide the option of POSIX
- * or Win32 threads.
- *
- * Revision 1.5 2001/07/15 18:00:46 jongfoster
- * Renaming STATIC to STATIC_PCRE.
- * Replacing this file with one built by "configure" from
- * "config.h.in", for consistency.
- *
- * Revision 1.6 2001/07/15 17:54:29 jongfoster
- * Renaming #define STATIC to STATIC_PCRE
- * Adding new #define FEATURE_PTHREAD that will be used to enable
- * POSIX threads support.
- *
- * Revision 1.5 2001/07/13 13:48:37 oes
- * - (Fix:) Copied CODE_STATUS #define from config.h.in
- * - split REGEX #define into REGEX_GNU and REGEX_PCRE
- * and removed PCRE.
- * (REGEX = REGEX_GNU || REGEX_PCRE per project.h)
- * - Moved STATIC (for pcre) here from Makefile.in
- * - Introduced STATIC_PCRS #define to allow for dynaimc linking with
- * libpcrs
- * - Removed PCRS #define, since pcrs is now needed for CGI anyway
- *
- * Revision 1.4 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.3 2001/05/26 01:26:34 jongfoster
- * New #define, WIN_GUI_EDIT, enables the (embryonic) Win32 GUI editor.
- * This #define cannot be set from ./configure - there's no point, it
- * doesn't work yet. See feature request # 425722
- *
- * Revision 1.2 2001/05/22 17:43:35 oes
- *
- * - Enabled filtering banners by size rather than URL
- * by adding patterns that replace all standard banner
- * sizes with the "Junkbuster" gif to the re_filterfile
- *
- * - Enabled filtering WebBugs by providing a pattern
- * which kills all 1x1 images
- *
- * - Added support for PCRE_UNGREEDY behaviour to pcrs,
- * which is selected by the (nonstandard and therefore
- * capital) letter 'U' in the option string.
- * It causes the quantifiers to be ungreedy by default.
- * Appending a ? turns back to greedy (!).
- *
- * - Added a new interceptor ijb-send-banner, which
- * sends back the "Junkbuster" gif. Without imagelist or
- * MSIE detection support, or if tinygif = 1, or the
- * URL isn't recognized as an imageurl, a lame HTML
- * explanation is sent instead.
- *
- * - Added new feature, which permits blocking remote
- * script redirects and firing back a local redirect
- * to the browser.
- * The feature is conditionally compiled, i.e. it
- * can be disabled with --disable-fast-redirects,
- * plus it must be activated by a "fast-redirects"
- * line in the config file, has its own log level
- * and of course wants to be displayed by show-proxy-args
- * Note: Boy, all the #ifdefs in 1001 locations and
- * all the fumbling with configure.in and acconfig.h
- * were *way* more work than the feature itself :-(
- *
- * - Because a generic redirect template was needed for
- * this, tinygif = 3 now uses the same.
- *
- * - Moved GIFs, and other static HTTP response templates
- * to project.h
- *
- * - Many minor fixes
- *
- * - Removed some >400 CRs again (Jon, you really worked
- * a lot! ;-)
- *
- * Revision 1.1.1.1 2001/05/15 13:58:45 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
/*
* Version number - Major (X._._)
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: w32.rc,v $
- * Revision 1.21 2008/11/02 14:37:47 ler762
- * commit the part of the patches I've been using that were written by torford and gjmurphy
- * [ 1824315 ] Minor code cleanup
- * [ 1781135 ] Patch - Add clear log, select all, and Accelerators for w32
- * http://sourceforge.net/tracker/?func=detail&atid=311118&aid=1781135&group_id=11118
- * The full patch adds control keys A(select all), C(copy) and D(delete all) to the
- * Privoxy log window menu. Select all and copy work for me without the patch
- * (albeit without showing the accelerator keys on the menu), so the only part of the
- * patch I've been using for the last year or so has been the ctrl-d to delete
- * everything in the Privoxy log window.
- *
- * Revision 1.20 2006/08/18 02:06:25 david__schmidt
- * Making icon go back to blue when idle.
- * See: bug #967648.
- *
- * Revision 1.19 2006/07/18 14:48:48 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.17.2.1 2002/08/21 17:58:40 oes
- * - Reorder of Win32 menu
- * - "Show Privoxy Window" now a toggle
- * - Temp kludge to let user and default action file be edited through win32 GUI (FR 592080)
- *
- * Revision 1.17 2002/03/31 17:19:00 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.16 2002/03/26 22:57:44 jongfoster
- * Web server name should begin www.
- *
- * Revision 1.15 2002/03/24 14:29:25 jongfoster
- * Renaming icon file
- *
- * Revision 1.14 2002/03/24 12:07:36 jongfoster
- * Consistern name for filters file
- *
- * Revision 1.13 2002/03/24 12:03:47 jongfoster
- * Name change
- *
- * Revision 1.12 2001/07/30 22:16:07 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.11 2001/07/21 17:53:41 jongfoster
- * Adding version information block.
- *
- * Revision 1.10 2001/07/19 19:14:19 haroon
- * - Removed all #ifdef PCRS. The .rc file extension had eluded Andreas.
- *
- * Revision 1.9 2001/06/07 23:08:54 jongfoster
- * Forward and ACL edit options removed.
- * Config edit option renamed from "&Junkbuster" to "&Configuration".
- *
- * Revision 1.8 2001/05/31 21:37:11 jongfoster
- * GUI changes to rename "permissions file" to "actions file".
- *
- * Revision 1.7 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.6 2001/05/26 14:15:18 jongfoster
- * Cosmetic fix: // -> block comment
- *
- * Revision 1.5 2001/05/26 13:24:31 jongfoster
- * New #define, WIN_GUI_EDIT, enables the (embryonic) Win32 GUI editor.
- * This #define cannot be set from ./configure - there's no point, it
- * doesn't work yet. See feature request # 425722
- * (I missed this file in my original checkin)
- *
- * Revision 1.4 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.3 2001/05/25 22:33:40 jongfoster
- * CRLF->LF
- *
- * 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:07 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
#include "config.h"
-const char w32log_rcs[] = "$Id: w32log.c,v 1.32 2009/03/09 18:32:48 fabiankeil Exp $";
+const char w32log_rcs[] = "$Id: w32log.c,v 1.33 2009/03/09 19:02:09 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/w32log.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: w32log.c,v $
- * Revision 1.32 2009/03/09 18:32:48 fabiankeil
- * Use the Privoxy icon in the alt+tab window.
- * Patch submitted by Burberry in #2674342.
- *
- * Revision 1.31 2009/03/07 17:58:02 fabiankeil
- * Fix two mingw32-only buffer overflows. Note that triggering
- * them requires control over the configuration file in which
- * case all bets are off anyway.
- *
- * Revision 1.30 2009/01/01 15:09:23 ler762
- * Change the Windows taskbar icon when privoxy is toggled off.
- *
- * Revision 1.29 2008/12/20 15:27:40 ler762
- * The crunch log message format changed, so update the strings to highlight
- * in the log window.
- *
- * Revision 1.28 2008/11/02 14:37:47 ler762
- * commit the part of the patches I've been using that were written by torford and gjmurphy
- * [ 1824315 ] Minor code cleanup
- * [ 1781135 ] Patch - Add clear log, select all, and Accelerators for w32
- * http://sourceforge.net/tracker/?func=detail&atid=311118&aid=1781135&group_id=11118
- * The full patch adds control keys A(select all), C(copy) and D(delete all) to the
- * Privoxy log window menu. Select all and copy work for me without the patch
- * (albeit without showing the accelerator keys on the menu), so the only part of the
- * patch I've been using for the last year or so has been the ctrl-d to delete
- * everything in the Privoxy log window.
- *
- * Revision 1.27 2006/07/18 14:48:48 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.25.2.5 2003/04/04 12:48:51 oes
- * Fixed bug #711865:
- * - Made tray menu correctly reflect initial window visibility state
- * - Hopefully fixed problem where log window contents wasn't visible
- * until vertical scroll bar was clicked. Thanks to Guy for the fix!
- *
- * Revision 1.25.2.4 2003/03/11 11:53:59 oes
- * Cosmetic: Renamed cryptic variable
- *
- * Revision 1.25.2.3 2002/11/20 14:39:05 oes
- * Fixed compiler warning
- *
- * Revision 1.25.2.2 2002/09/25 15:23:10 oes
- * Uncheck the "Show Privoxy Window" taskbar menu item when window gets minimized. Fixes bug #606804
- *
- * Revision 1.25.2.1 2002/08/21 17:59:05 oes
- * - "Show Privoxy Window" now a toggle
- * - Temp kludge to let user and default action file be edited through win32 GUI (FR 592080)
- *
- * Revision 1.25 2002/04/04 00:36:36 gliptak
- * always use pcre for matching
- *
- * Revision 1.24 2002/03/31 17:19:00 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.23 2002/03/26 22:57:10 jongfoster
- * Web server name should begin www.
- *
- * Revision 1.22 2002/03/24 12:48:23 jongfoster
- * Fixing doc links
- *
- * Revision 1.21 2002/03/24 12:07:35 jongfoster
- * Consistern name for filters file
- *
- * Revision 1.20 2002/03/24 12:03:47 jongfoster
- * Name change
- *
- * Revision 1.19 2002/01/17 21:04:17 jongfoster
- * Replacing hard references to the URL of the config interface
- * with #defines from project.h
- *
- * Revision 1.18 2001/11/30 23:37:24 jongfoster
- * Renaming the Win32 config file to config.txt - this is almost the
- * same as the corresponding UNIX name "config"
- *
- * Revision 1.17 2001/11/16 00:46:31 jongfoster
- * Fixing compiler warnings
- *
- * Revision 1.16 2001/08/01 19:58:12 jongfoster
- * Fixing documentation filenames in help menu, and making status
- * option work without needing the "Junkbuster Status.URL" file.
- *
- * Revision 1.15 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.14 2001/07/29 18:47:05 jongfoster
- * Adding missing #include "loadcfg.h"
- *
- * Revision 1.13 2001/07/19 19:15:14 haroon
- * - Added a FIXME for EditFile but didn't fix :-)
- *
- * Revision 1.12 2001/07/13 14:04:59 oes
- * Removed all #ifdef PCRS
- *
- * Revision 1.11 2001/06/07 23:08:12 jongfoster
- * Forward and ACL edit options removed.
- *
- * Revision 1.10 2001/05/31 21:37:11 jongfoster
- * GUI changes to rename "permissions file" to "actions file".
- *
- * Revision 1.9 2001/05/31 17:33:13 oes
- *
- * CRLF -> LF
- *
- * Revision 1.8 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.7 2001/05/26 01:26:34 jongfoster
- * New #define, WIN_GUI_EDIT, enables the (embryonic) Win32 GUI editor.
- * This #define cannot be set from ./configure - there's no point, it
- * doesn't work yet. See feature request # 425722
- *
- * Revision 1.6 2001/05/26 00:31:30 jongfoster
- * Fixing compiler warning about comparing signed/unsigned.
- *
- * 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:56:28 oes
- * CRLF -> LF
- *
- * Revision 1.3 2001/05/20 15:07:54 jongfoster
- * File is now ignored if _WIN_CONSOLE is defined.
- *
- * 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:07 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef W32LOG_H_INCLUDED
#define W32LOG_H_INCLUDED
-#define W32LOG_H_VERSION "$Id: w32log.h,v 1.12 2006/07/18 14:48:48 david__schmidt Exp $"
+#define W32LOG_H_VERSION "$Id: w32log.h,v 1.13 2009/03/07 17:58:02 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/w32log.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: w32log.h,v $
- * Revision 1.12 2006/07/18 14:48:48 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.10.2.2 2002/11/20 14:39:05 oes
- * Fixed compiler warning
- *
- * Revision 1.10.2.1 2002/08/21 17:58:05 oes
- * Temp kludge to let user and default action file be edited through win32 GUI (FR 592080)
- *
- * Revision 1.10 2002/03/26 22:57:10 jongfoster
- * Web server name should begin www.
- *
- * Revision 1.9 2002/03/24 12:03:47 jongfoster
- * Name change
- *
- * Revision 1.8 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.7 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.6 2001/07/13 14:04:59 oes
- * Removed all #ifdef PCRS
- *
- * Revision 1.5 2001/06/07 23:08:12 jongfoster
- * Forward and ACL edit options removed.
- *
- * Revision 1.4 2001/05/31 21:37:11 jongfoster
- * GUI changes to rename "permissions file" to "actions file".
- *
- * Revision 1.3 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.2 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.1.1.1 2001/05/15 13:59:07 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
#ifndef W32RES_H_INCLUDED
#define W32RES_H_INCLUDED
-#define W32RES_H_VERSION "$Id: w32res.h,v 1.16 2008/11/02 14:37:47 ler762 Exp $"
+#define W32RES_H_VERSION "$Id: w32res.h,v 1.17 2009/01/01 15:09:23 ler762 Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/w32res.h,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: w32res.h,v $
- * Revision 1.16 2008/11/02 14:37:47 ler762
- * commit the part of the patches I've been using that were written by torford and gjmurphy
- * [ 1824315 ] Minor code cleanup
- * [ 1781135 ] Patch - Add clear log, select all, and Accelerators for w32
- * http://sourceforge.net/tracker/?func=detail&atid=311118&aid=1781135&group_id=11118
- * The full patch adds control keys A(select all), C(copy) and D(delete all) to the
- * Privoxy log window menu. Select all and copy work for me without the patch
- * (albeit without showing the accelerator keys on the menu), so the only part of the
- * patch I've been using for the last year or so has been the ctrl-d to delete
- * everything in the Privoxy log window.
- *
- * Revision 1.15 2006/07/18 14:48:48 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.13.2.1 2002/08/21 17:59:06 oes
- * - "Show Privoxy Window" now a toggle
- * - Temp kludge to let user and default action file be edited through win32 GUI (FR 592080)
- *
- * Revision 1.13 2002/03/26 22:57:10 jongfoster
- * Web server name should begin www.
- *
- * Revision 1.12 2002/03/24 12:07:36 jongfoster
- * Consistern name for filters file
- *
- * Revision 1.11 2002/03/24 12:03:47 jongfoster
- * Name change
- *
- * Revision 1.10 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.9 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.8 2001/07/13 14:04:59 oes
- * Removed all #ifdef PCRS
- *
- * Revision 1.7 2001/06/07 23:08:12 jongfoster
- * Forward and ACL edit options removed.
- *
- * Revision 1.6 2001/05/31 21:37:11 jongfoster
- * GUI changes to rename "permissions file" to "actions file".
- *
- * Revision 1.5 2001/05/29 09:50:24 jongfoster
- * Unified blocklist/imagelist/permissionslist.
- * File format is still under discussion, but the internal changes
- * are (mostly) done.
- *
- * Also modified interceptor behaviour:
- * - We now intercept all URLs beginning with one of the following
- * prefixes (and *only* these prefixes):
- * * http://i.j.b/
- * * http://ijbswa.sf.net/config/
- * * http://ijbswa.sourceforge.net/config/
- * - New interceptors "home page" - go to http://i.j.b/ to see it.
- * - Internal changes so that intercepted and fast redirect pages
- * are not replaced with an image.
- * - Interceptors now have the option to send a binary page direct
- * to the client. (i.e. ijb-send-banner uses this)
- * - Implemented show-url-info interceptor. (Which is why I needed
- * the above interceptors changes - a typical URL is
- * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
- * The previous mechanism would not have intercepted that, and
- * if it had been intercepted then it then it would have replaced
- * it with an image.)
- *
- * Revision 1.4 2001/05/26 01:26:34 jongfoster
- * New #define, WIN_GUI_EDIT, enables the (embryonic) Win32 GUI editor.
- * This #define cannot be set from ./configure - there's no point, it
- * doesn't work yet. See feature request # 425722
- *
- * Revision 1.3 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.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:08 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
#define IDR_TRAYMENU 101
-const char w32_svrapi_rcs[] = "$Id: w32svrapi.c,v 1.1 2006/08/12 03:54:37 david__schmidt Exp $";
+const char w32_svrapi_rcs[] = "$Id: w32svrapi.c,v 1.2 2006/09/20 03:15:43 david__schmidt Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/w32svrapi.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: w32svrapi.c,v $
- * Revision 1.1 2006/08/12 03:54:37 david__schmidt
- * Windows service integration
- *
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef W32_SVRAPI_H_INCLUDED
#define W32_SVRAPI_H_INCLUDED
-#define W32_SVRAPI_H_VERSION "$Id$"
+#define W32_SVRAPI_H_VERSION "$Id: w32svrapi.h,v 1.1 2006/08/12 03:54:37 david__schmidt Exp $"
/*********************************************************************
*
- * File : $Source$
+ * File : $Source: /cvsroot/ijbswa/current/w32svrapi.h,v $
*
* Purpose : Win32 Services API for Privoxy.
* Provides the implementation of an Win32 service to
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log$
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.9 2006/07/18 14:48:48 david__schmidt Exp $";
+const char w32taskbar_rcs[] = "$Id: w32taskbar.c,v 1.10 2006/09/23 13:26:38 roro Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/w32taskbar.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: w32taskbar.c,v $
- * Revision 1.9 2006/07/18 14:48:48 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.7.2.2 2003/03/19 21:27:42 gliptak
- * Corrected compilation error/typo
- *
- * Revision 1.7.2.1 2002/11/20 14:39:32 oes
- * Applied patch by Mattes Dolak which adds re-creation of the win32 taskbar
- * icon on reception of the "TaskbarCreated" window message.
- *
- * Revision 1.7 2002/03/31 17:19:00 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.6 2002/03/26 22:57:10 jongfoster
- * Web server name should begin www.
- *
- * Revision 1.5 2002/03/24 12:03:47 jongfoster
- * Name change
- *
- * Revision 1.4 2001/11/16 00:46:31 jongfoster
- * Fixing compiler warnings
- *
- * Revision 1.3 2001/05/22 18:56:28 oes
- * CRLF -> LF
- *
- * Revision 1.2 2001/05/20 15:07:54 jongfoster
- * File is now ignored if _WIN_CONSOLE is defined.
- *
- * Revision 1.1.1.1 2001/05/15 13:59:08 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef W32TASKBAR_H_INCLUDED
#define W32TASKBAR_H_INCLUDED
-#define W32TASKBAR_H_VERSION "$Id: w32taskbar.h,v 1.4 2002/03/26 22:57:10 jongfoster Exp $"
+#define W32TASKBAR_H_VERSION "$Id: w32taskbar.h,v 1.6 2006/07/18 14:48:48 david__schmidt Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/Attic/w32taskbar.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/w32taskbar.h,v $
*
* Purpose : Functions for creating, setting and destroying the
* workspace tray icon
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: w32taskbar.h,v $
- * Revision 1.4 2002/03/26 22:57:10 jongfoster
- * Web server name should begin www.
- *
- * Revision 1.3 2002/03/24 12:03:47 jongfoster
- * Name change
- *
- * Revision 1.2 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.1.1.1 2001/05/15 13:59:08 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {
-const char win32_rcs[] = "$Id: win32.c,v 1.14 2008/03/02 18:15:41 fabiankeil Exp $";
+const char win32_rcs[] = "$Id: win32.c,v 1.15 2009/02/09 19:16:35 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/win32.c,v $
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: win32.c,v $
- * Revision 1.14 2008/03/02 18:15:41 fabiankeil
- * Update copyright year in win32_blurb[].
- *
- * Revision 1.13 2007/01/31 16:25:24 fabiankeil
- * Update copyright range for the About message.
- *
- * Revision 1.12 2006/08/12 03:54:37 david__schmidt
- * Windows service integration
- *
- * Revision 1.11 2006/07/18 14:48:48 david__schmidt
- * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
- * with what was really the latest development (the v_3_0_branch branch)
- *
- * Revision 1.9.2.2 2002/08/27 18:03:40 oes
- * Fixed stupid typo
- *
- * Revision 1.9.2.1 2002/08/21 17:59:27 oes
- * Sync win32_blurb[] with our standard blurb
- *
- * Revision 1.9 2002/03/31 17:19:00 jongfoster
- * Win32 only: Enabling STRICT to fix a VC++ compile warning.
- *
- * Revision 1.8 2002/03/26 22:57:10 jongfoster
- * Web server name should begin www.
- *
- * Revision 1.7 2002/03/24 12:03:47 jongfoster
- * Name change
- *
- * Revision 1.6 2002/03/16 21:53:28 jongfoster
- * VC++ Heap debug option
- *
- * Revision 1.5 2002/03/04 23:47:30 jongfoster
- * - Rewritten, simpler command-line pre-parser
- * - not using raise(SIGINT) any more
- *
- * Revision 1.4 2001/11/30 21:29:33 jongfoster
- * Fixing a warning
- *
- * Revision 1.3 2001/11/16 00:46:31 jongfoster
- * Fixing compiler warnings
- *
- * Revision 1.2 2001/07/29 19:32:00 jongfoster
- * Renaming _main() [mingw32 only] to real_main(), for ANSI compliance.
- *
- * Revision 1.1.1.1 2001/05/15 13:59:08 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#include "config.h"
#ifndef WIN32_H_INCLUDED
#define WIN32_H_INCLUDED
-#define WIN32_H_VERSION "$Id: win32.h,v 1.5 2002/03/26 22:57:10 jongfoster Exp $"
+#define WIN32_H_VERSION "$Id: win32.h,v 1.7 2006/07/18 14:48:48 david__schmidt Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/Attic/win32.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/win32.h,v $
*
* Purpose : Win32 User Interface initialization and message loop
*
* or write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Revisions :
- * $Log: win32.h,v $
- * Revision 1.5 2002/03/26 22:57:10 jongfoster
- * Web server name should begin www.
- *
- * Revision 1.4 2002/03/24 12:03:47 jongfoster
- * Name change
- *
- * Revision 1.3 2001/07/30 22:08:36 jongfoster
- * Tidying up #defines:
- * - All feature #defines are now of the form FEATURE_xxx
- * - Permanently turned off WIN_GUI_EDIT
- * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
- *
- * Revision 1.2 2001/07/29 18:43:08 jongfoster
- * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to
- * ANSI C rules.
- *
- * Revision 1.1.1.1 2001/05/15 13:59:08 oes
- * Initial import of version 2.9.3 source tree
- *
- *
*********************************************************************/
-\f
+
#ifdef __cplusplus
extern "C" {