X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=loadcfg.c;h=57c0e0f88437bed22362af2b203583b0f08c04b9;hb=7cd7f5452175e5c161896a757f01ade31fcdac02;hp=831af1cc09f1d7dacf827ba29c06e392c4b56246;hpb=72081f829de368392d04076728f8c991178c0080;p=privoxy.git diff --git a/loadcfg.c b/loadcfg.c index 831af1cc..57c0e0f8 100644 --- a/loadcfg.c +++ b/loadcfg.c @@ -1,7 +1,7 @@ -const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.48.2.7 2006/02/02 17:29:16 david__schmidt Exp $"; +const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.55 2006/11/28 15:31:52 fabiankeil Exp $"; /********************************************************************* * - * File : $Source: /cvsroot/ijbswa/current/Attic/loadcfg.c,v $ + * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $ * * Purpose : Loads settings from the configuration file into * global variables. This file contains both the @@ -35,6 +35,39 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.48.2.7 2006/02/02 17:29:16 david_ * * Revisions : * $Log: loadcfg.c,v $ + * 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... * @@ -430,10 +463,12 @@ static struct file_list *current_configfile = NULL; #define hash_deny_access 1227333715ul /* "deny-access" */ #define hash_enable_edit_actions 2517097536ul /* "enable-edit-actions" */ #define hash_enable_remote_toggle 2979744683ul /* "enable-remote-toggle" */ +#define hash_enable_remote_http_toggle 110543988ul /* "enable-remote-http-toggle" */ #define hash_filterfile 250887266ul /* "filterfile" */ #define hash_forward 2029845ul /* "forward" */ #define hash_forward_socks4 3963965521ul /* "forward-socks4" */ #define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */ +#define hash_forwarded_connect_retries 101465292ul /* "forwarded-connect-retries" */ #define hash_jarfile 2046641ul /* "jarfile" */ #define hash_listen_address 1255650842ul /* "listen-address" */ #define hash_logdir 422889ul /* "logdir" */ @@ -520,6 +555,8 @@ void unload_configfile (void * data) { freez(config->actions_file_short[i]); freez(config->actions_file[i]); + freez(config->re_filterfile_short[i]); + freez(config->re_filterfile[i]); } freez(config->admin_address); @@ -632,11 +669,13 @@ struct configuration_spec * load_config(void) /* * Set to defaults */ - config->multi_threaded = 1; - config->hport = HADDR_PORT; - config->buffer_limit = 4096 * 1024; - config->usermanual = strdup(USER_MANUAL_URL); - config->proxy_args = strdup(""); + config->multi_threaded = 1; + config->hport = HADDR_PORT; + config->buffer_limit = 4096 * 1024; + config->usermanual = strdup(USER_MANUAL_URL); + config->proxy_args = strdup(""); + config->forwarded_connect_retries = 0; + config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE; if ((configfp = fopen(configfile, "r")) == NULL) { @@ -865,6 +904,20 @@ struct configuration_spec * load_config(void) continue; #endif /* def FEATURE_CGI_EDIT_ACTIONS */ +/* ************************************************************************* + * enable-remote-http-toggle 0|1 + * *************************************************************************/ + case hash_enable_remote_http_toggle: + if ((*arg != '\0') && (0 != atoi(arg))) + { + config->feature_flags |= RUNTIME_FEATURE_HTTP_TOGGLE; + } + else + { + config->feature_flags &= ~RUNTIME_FEATURE_HTTP_TOGGLE; + } + continue; + /* ************************************************************************* * filterfile file-name * In confdir by default. @@ -1115,6 +1168,13 @@ struct configuration_spec * load_config(void) continue; +/* ************************************************************************* + * forwarded-connect-retries n + * *************************************************************************/ + case hash_forwarded_connect_retries : + config->forwarded_connect_retries = atoi(arg); + continue; + /* ************************************************************************* * jarfile jar-file-name * In logdir by default @@ -1513,7 +1573,7 @@ struct configuration_spec * load_config(void) g_default_actions_file = config->actions_file[1]; /* FIXME Hope this is default.action */ g_user_actions_file = config->actions_file[2]; /* FIXME Hope this is user.action */ - g_re_filterfile = config->re_filterfile; + g_re_filterfile = config->re_filterfile[0]; /* FIXME Hope this is default.filter */ #ifdef FEATURE_TRUST g_trustfile = config->trustfile; @@ -1600,8 +1660,18 @@ static void savearg(char *command, char *argument, struct configuration_spec * c * Add config option name embedded in * link to it's section in the user-manual */ - buf = strdup("\n
usermanual); + buf = strdup("\nusermanual, "file://", 7) || + !strncmpic(config->usermanual, "http", 4)) + { + string_append(&buf, config->usermanual); + } + else + { + string_append(&buf, "http://"); + string_append(&buf, CGI_SITE_2_HOST); + string_append(&buf, "/user-manual/"); + } string_append(&buf, CONFIG_HELP_PREFIX); string_join (&buf, string_toupper(command)); string_append(&buf, "\">"); @@ -1638,6 +1708,7 @@ static void savearg(char *command, char *argument, struct configuration_spec * c } } + string_append(&buf, "
"); string_join(&config->proxy_args, buf); }