X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=loadcfg.c;h=dff7325886a8f49c8d251e24bff97da794071f01;hp=831af1cc09f1d7dacf827ba29c06e392c4b56246;hb=d8c3628ce4a3e4fee2d5dd023c2b4e5188c5ad16;hpb=72081f829de368392d04076728f8c991178c0080 diff --git a/loadcfg.c b/loadcfg.c index 831af1cc..dff73258 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.58 2006/12/31 14:24:29 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,52 @@ 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.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
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... * @@ -422,40 +468,44 @@ static struct file_list *current_configfile = NULL; * console and GUI specific options last). */ -#define hash_actions_file 1196306641ul /* "actionsfile" */ -#define hash_admin_address 4112573064ul /* "admin-address" */ -#define hash_buffer_limit 1881726070ul /* "buffer-limit */ -#define hash_confdir 1978389ul /* "confdir" */ -#define hash_debug 78263ul /* "debug" */ -#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_filterfile 250887266ul /* "filterfile" */ -#define hash_forward 2029845ul /* "forward" */ -#define hash_forward_socks4 3963965521ul /* "forward-socks4" */ -#define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */ -#define hash_jarfile 2046641ul /* "jarfile" */ -#define hash_listen_address 1255650842ul /* "listen-address" */ -#define hash_logdir 422889ul /* "logdir" */ -#define hash_logfile 2114766ul /* "logfile" */ -#define hash_permit_access 3587953268ul /* "permit-access" */ -#define hash_proxy_info_url 3903079059ul /* "proxy-info-url" */ -#define hash_single_threaded 4250084780ul /* "single-threaded" */ -#define hash_suppress_blocklists 1948693308ul /* "suppress-blocklists" */ -#define hash_toggle 447966ul /* "toggle" */ -#define hash_trust_info_url 430331967ul /* "trust-info-url" */ -#define hash_trustfile 56494766ul /* "trustfile" */ -#define hash_usermanual 1416668518ul /* "user-manual" */ -#define hash_activity_animation 1817904738ul /* "activity-animation" */ -#define hash_close_button_minimizes 3651284693ul /* "close-button-minimizes" */ -#define hash_hide_console 2048809870ul /* "hide-console" */ -#define hash_log_buffer_size 2918070425ul /* "log-buffer-size" */ -#define hash_log_font_name 2866730124ul /* "log-font-name" */ -#define hash_log_font_size 2866731014ul /* "log-font-size" */ -#define hash_log_highlight_messages 4032101240ul /* "log-highlight-messages" */ -#define hash_log_max_lines 2868344173ul /* "log-max-lines" */ -#define hash_log_messages 2291744899ul /* "log-messages" */ -#define hash_show_on_task_bar 215410365ul /* "show-on-task-bar" */ +#define hash_actions_file 1196306641ul /* "actionsfile" */ +#define hash_accept_intercepted_requests 1513024973ul /* "accept-intercepted-requests" */ +#define hash_admin_address 4112573064ul /* "admin-address" */ +#define hash_buffer_limit 1881726070ul /* "buffer-limit */ +#define hash_confdir 1978389ul /* "confdir" */ +#define hash_debug 78263ul /* "debug" */ +#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" */ +#define hash_logfile 2114766ul /* "logfile" */ +#define hash_permit_access 3587953268ul /* "permit-access" */ +#define hash_proxy_info_url 3903079059ul /* "proxy-info-url" */ +#define hash_single_threaded 4250084780ul /* "single-threaded" */ +#define hash_split_large_cgi_forms 671658948ul /* "split-large-cgi-forms" */ +#define hash_suppress_blocklists 1948693308ul /* "suppress-blocklists" */ +#define hash_toggle 447966ul /* "toggle" */ +#define hash_trust_info_url 430331967ul /* "trust-info-url" */ +#define hash_trustfile 56494766ul /* "trustfile" */ +#define hash_usermanual 1416668518ul /* "user-manual" */ +#define hash_activity_animation 1817904738ul /* "activity-animation" */ +#define hash_close_button_minimizes 3651284693ul /* "close-button-minimizes" */ +#define hash_hide_console 2048809870ul /* "hide-console" */ +#define hash_log_buffer_size 2918070425ul /* "log-buffer-size" */ +#define hash_log_font_name 2866730124ul /* "log-font-name" */ +#define hash_log_font_size 2866731014ul /* "log-font-size" */ +#define hash_log_highlight_messages 4032101240ul /* "log-highlight-messages" */ +#define hash_log_max_lines 2868344173ul /* "log-max-lines" */ +#define hash_log_messages 2291744899ul /* "log-messages" */ +#define hash_show_on_task_bar 215410365ul /* "show-on-task-bar" */ static void savearg(char *command, char *argument, struct configuration_spec * config); @@ -520,6 +570,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 +684,15 @@ 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; + config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS; + config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS; if ((configfp = fopen(configfile, "r")) == NULL) { @@ -688,7 +744,7 @@ struct configuration_spec * load_config(void) { if (ijb_isupper(*p)) { - *p = ijb_tolower(*p); + *p = (char)ijb_tolower(*p); } } @@ -726,6 +782,19 @@ struct configuration_spec * load_config(void) config->actions_file[i] = make_path(config->confdir, p); free(p); continue; +/* ************************************************************************* + * accept-intercepted-requests + * *************************************************************************/ + case hash_accept_intercepted_requests: + if ((*arg != '\0') && (0 != atoi(arg))) + { + config->feature_flags |= RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS; + } + else + { + config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS; + } + continue; /* ************************************************************************* * admin-address email-address @@ -739,7 +808,7 @@ struct configuration_spec * load_config(void) * buffer-limit n * *************************************************************************/ case hash_buffer_limit : - config->buffer_limit = (size_t) 1024 * atoi(arg); + config->buffer_limit = (size_t)(1024 * atoi(arg)); continue; /* ************************************************************************* @@ -865,6 +934,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 +1198,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 @@ -1243,6 +1333,20 @@ struct configuration_spec * load_config(void) config->multi_threaded = 0; continue; +/* ************************************************************************* + * split-large-cgi-forms + * *************************************************************************/ + case hash_split_large_cgi_forms : + if ((*arg != '\0') && (0 != atoi(arg))) + { + config->feature_flags |= RUNTIME_FEATURE_SPLIT_LARGE_FORMS; + } + else + { + config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS; + } + continue; + /* ************************************************************************* * toggle (0|1) * *************************************************************************/ @@ -1513,7 +1617,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 +1704,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 +1752,7 @@ static void savearg(char *command, char *argument, struct configuration_spec * c } } + string_append(&buf, "
"); string_join(&config->proxy_args, buf); }