X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=loadcfg.c;h=f788df2e5d2abed27bad63ba7df72fb8aaabc79f;hp=82bd91638b8428e983c538ebf31d62ad437b5fa6;hb=4090911b56d63973aa3c8415ca8662eee1b3a5bf;hpb=43da0ce639b1cf540198b2f63e790d9127725343 diff --git a/loadcfg.c b/loadcfg.c index 82bd9163..f788df2e 100644 --- a/loadcfg.c +++ b/loadcfg.c @@ -1,4 +1,4 @@ -const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.5 2001/05/25 22:34:30 jongfoster Exp $"; +const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.7 2001/05/29 09:50:24 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $ @@ -35,6 +35,36 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.5 2001/05/25 22:34:30 jongfoster * * Revisions : * $Log: loadcfg.c,v $ + * 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 * @@ -142,6 +172,7 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.5 2001/05/25 22:34:30 jongfoster #endif #include "loadcfg.h" +#include "list.h" #include "jcc.h" #include "filters.h" #include "loaders.h" @@ -166,15 +197,6 @@ const char loadcfg_h_rcs[] = LOADCFG_H_VERSION; #define ijb_isupper(__X) isupper((int)(unsigned char)(__X)) #define ijb_tolower(__X) tolower((int)(unsigned char)(__X)) -static const char VANILLA_WAFER[] = - "NOTICE=TO_WHOM_IT_MAY_CONCERN_" - "Do_not_send_me_any_copyrighted_information_other_than_the_" - "document_that_I_am_requesting_or_any_of_its_necessary_components._" - "In_particular_do_not_send_me_any_cookies_that_" - "are_subject_to_a_claim_of_copyright_by_anybody._" - "Take_notice_that_I_refuse_to_be_bound_by_any_license_condition_" - "(copyright_or_otherwise)_applying_to_any_cookie._"; - #ifdef TOGGLE /* by haroon - indicates if ijb is enabled */ int g_bToggleIJB = 1; /* JunkBusters is enabled by default. */ @@ -203,43 +225,33 @@ static struct file_list *current_configfile = NULL; * config file and read the number from the error message in the log). */ -#define hash_trustfile 56494766ul -#define hash_trust_info_url 449869467ul -#define hash_debug 78263ul -#define hash_tinygif 2227702ul -#define hash_add_forwarded_header 3191044770ul -#define hash_single_threaded 4250084780ul -#define hash_suppress_vanilla_wafer 3121233547ul -#define hash_wafer 89669ul -#define hash_add_header 237434619ul -#define hash_permissions_file 3825730796lu /* "permissionsfile" */ -#define hash_logfile 2114766ul -#define hash_blockfile 48845391ul -#define hash_imagefile 51447891ul -#define hash_jarfile 2046641ul -#define hash_listen_address 1255650842ul + +#define hash_aclfile 1908516ul +#define hash_actions_file 3825730796ul /* FIXME "permissionsfile" */ +#define hash_debug 78263ul #define hash_forwardfile 1268669141ul -#define hash_aclfile 1908516ul +#define hash_jarfile 2046641ul +#define hash_listen_address 1255650842ul +#define hash_logfile 2114766ul #define hash_re_filterfile 3877522444ul -#define hash_user_agent 283326691ul -#define hash_referrer 10883969ul -#define hash_referer 2176719ul -#define hash_from 16264ul -#define hash_fast_redirects 464873764lu -#define hash_hide_console 2048809870ul -#define hash_include_stats 2174146548ul +#define hash_single_threaded 4250084780ul #define hash_suppress_blocklists 1948693308ul -#define hash_toggle 447966ul +#define hash_tinygif 2227702ul /* FIXME should be in actions file */ +#define hash_toggle 447966ul +#define hash_trust_info_url 449869467ul +#define hash_trustfile 56494766ul + +#define hash_hide_console 2048809870ul #define hash_activity_animation 1817904738ul -#define hash_log_messages 2291744899ul -#define hash_log_highlight_messages 4032101240ul +#define hash_close_button_minimizes 3651284693ul #define hash_log_buffer_size 2918070425ul -#define hash_log_max_lines 2868344173ul #define hash_log_font_name 2866730124ul #define hash_log_font_size 2866731014ul -#define hash_show_on_task_bar 215410365ul -#define hash_close_button_minimizes 3651284693ul +#define hash_log_highlight_messages 4032101240ul +#define hash_log_max_lines 2868344173ul +#define hash_log_messages 2291744899ul +#define hash_show_on_task_bar 215410365ul @@ -266,28 +278,20 @@ void unload_configfile (void * data) config->jar = NULL; } #endif /* def JAR_FILES */ -#if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) +#ifdef IMAGE_BLOCKING freez((char *)config->tinygifurl); -#endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */ +#endif /* def IMAGE_BLOCKING */ - freez((char *)config->from); freez((char *)config->haddr); - freez((char *)config->uagent); - freez((char *)config->referrer); freez((char *)config->logfile); - freez((char *)config->blockfile); - freez((char *)config->permissions_file); + freez((char *)config->actions_file); freez((char *)config->forwardfile); #ifdef ACL_FILES freez((char *)config->aclfile); #endif /* def ACL_FILES */ -#ifdef USE_IMAGE_LIST - freez((char *)config->imagefile); -#endif /* def USE_IMAGE_LIST */ - #ifdef JAR_FILES freez((char *)config->jarfile); #endif /* def JAR_FILES */ @@ -322,7 +326,6 @@ struct configuration_spec * load_config(void) char *p, *q; FILE *configfp = NULL; struct configuration_spec * config = NULL; - int suppress_vanilla_wafer; struct client_state * fake_csp; struct file_list *fs; @@ -372,7 +375,6 @@ struct configuration_spec * load_config(void) */ config->multi_threaded = 1; - config->default_permissions = PERMIT_RE_FILTER; config->hport = HADDR_PORT; if ((configfp = fopen(configfile, "r")) == NULL) @@ -444,7 +446,7 @@ struct configuration_spec * load_config(void) config->debug |= atoi(arg); continue; -#if defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) +#ifdef IMAGE_BLOCKING case hash_tinygif : freez((char *)config->tinygifurl); config->tinygif = atoi(arg); @@ -477,31 +479,15 @@ struct configuration_spec * load_config(void) log_error(LOG_LEVEL_ERROR, "tinygif setting invalid."); } continue; -#endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */ - - case hash_add_forwarded_header : - config->add_forwarded = 1; - continue; +#endif /* def IMAGE_BLOCKING */ case hash_single_threaded : config->multi_threaded = 0; continue; - case hash_suppress_vanilla_wafer : - suppress_vanilla_wafer = 1; - continue; - - case hash_wafer : - enlist(config->wafer_list, arg); - continue; - - case hash_add_header : - enlist(config->xtra_list, arg); - continue; - - case hash_permissions_file : - freez((char *)config->permissions_file); - config->permissions_file = strdup(arg); + case hash_actions_file : + freez((char *)config->actions_file); + config->actions_file = strdup(arg); continue; case hash_logfile : @@ -509,18 +495,6 @@ struct configuration_spec * load_config(void) config->logfile = strdup(arg); continue; - case hash_blockfile : - freez((char *)config->blockfile); - config->blockfile = strdup(arg); - continue; - -#ifdef USE_IMAGE_LIST - case hash_imagefile : - freez((char *)config->imagefile); - config->imagefile = strdup(arg); - continue; -#endif /* def USE_IMAGE_LIST */ - #ifdef JAR_FILES case hash_jarfile : freez((char *)config->jarfile); @@ -552,32 +526,6 @@ struct configuration_spec * load_config(void) continue; #endif /* def PCRS */ - case hash_user_agent : - freez((char *)config->uagent); - config->uagent = strdup(arg); - continue; - - /* - * Offer choice of correct spelling according to dictionary, - * or the misspelling used in the HTTP spec. - */ - case hash_referrer : - case hash_referer : - freez((char *)config->referrer); - config->referrer = strdup(arg); - continue; - - case hash_from : - freez((char *)config->from); - config->from = strdup(arg); - continue; - -#ifdef FAST_REDIRECTS - case hash_fast_redirects : - config->fast_redirects = 1; - continue; -#endif /* def FAST_REDIRECTS */ - #ifdef _WIN_CONSOLE case hash_hide_console : hideConsole = 1; @@ -646,9 +594,6 @@ struct configuration_spec * load_config(void) /* Warnings about unsupported features */ -#ifndef USE_IMAGE_LIST - case hash_imagefile : -#endif /* ndef USE_IMAGE_LIST */ #ifndef PCRS case hash_re_filterfile : #endif /* ndef PCRS */ @@ -669,18 +614,15 @@ struct configuration_spec * load_config(void) #ifndef _WIN_CONSOLE case hash_hide_console : #endif /* ndef _WIN_CONSOLE */ -#if !defined(DETECT_MSIE_IMAGES) && !defined(USE_IMAGE_LIST) +#ifndef IMAGE_BLOCKING case hash_tinygif : -#endif /* !defined(DETECT_MSIE_IMAGES) && !defined(USE_IMAGE_LIST) */ +#endif /* def IMAGE_BLOCKING */ #ifndef JAR_FILES case hash_jarfile : #endif /* ndef JAR_FILES */ #ifndef ACL_FILES case hash_aclfile : #endif /* ndef ACL_FILES */ -#ifndef FAST_REDIRECTS - case hash_fast_redirects : -#endif /* ndef FAST_REDIRECTS */ #ifdef SPLIT_PROXY_ARGS case hash_suppress_blocklists : #endif /* def SPLIT_PROXY_ARGS */ @@ -699,7 +641,7 @@ struct configuration_spec * load_config(void) if (p != NULL) { sprintf( p, "
\nWARNING: unrecognized directive : %s

\n", buf ); - config->proxy_args->invocation = strsav( config->proxy_args->invocation, p ); + config->proxy_args_invocation = strsav( config->proxy_args_invocation, p ); freez( p ); } continue; @@ -710,23 +652,11 @@ struct configuration_spec * load_config(void) init_error_log(Argv[0], config->logfile, config->debug); - if (config->permissions_file) - { - add_loader(load_permissions_file, config); - } - - if (config->blockfile) + if (config->actions_file) { - add_loader(load_blockfile, config); + add_loader(load_actions_file, config); } -#ifdef USE_IMAGE_LIST - if (config->imagefile) - { - add_loader(load_imagefile, config); - } -#endif /* def USE_IMAGE_LIST */ - if (config->forwardfile) { add_loader(load_forwardfile, config); @@ -745,13 +675,13 @@ struct configuration_spec * load_config(void) add_loader(load_re_filterfile, config); } #endif /* def PCRS */ - -#ifdef TRUST_FILES - if (config->trustfile) - { - add_loader(load_trustfile, config); - } -#endif + +#ifdef TRUST_FILES + if (config->trustfile) + { + add_loader(load_trustfile, config); + } +#endif #ifdef JAR_FILES if ( NULL != config->jarfile ) @@ -809,20 +739,6 @@ struct configuration_spec * load_config(void) } freez(fake_csp); -#ifdef JAR_FILES - /* - * If we're logging cookies in a cookie jar, and the user has not - * supplied any wafers, and the user has not told us to suppress the - * vanilla wafer, then send the vanilla wafer. - */ - if ((config->jarfile != NULL) - && (config->wafer_list->next == NULL) - && (suppress_vanilla_wafer == 0)) - { - enlist(config->wafer_list, VANILLA_WAFER); - } -#endif /* def JAR_FILES */ - end_proxy_args(config); #ifndef SPLIT_PROXY_ARGS @@ -835,21 +751,17 @@ struct configuration_spec * load_config(void) /* FIXME: this is a kludge for win32 */ #if defined(_WIN32) && !defined (_WIN_CONSOLE) - g_blockfile = config->blockfile; - g_permissions_file = config->permissions_file; + g_actions_file = config->actions_file; g_forwardfile = config->forwardfile; #ifdef ACL_FILES g_aclfile = config->aclfile; #endif /* def ACL_FILES */ -#ifdef USE_IMAGE_LIST - g_imagefile = config->imagefile; -#endif /* def USE_IMAGE_LIST */ -#ifdef PCRS - g_re_filterfile = config->re_filterfile; -#endif -#ifdef TRUST_FILES - g_trustfile = config->trustfile; -#endif +#ifdef PCRS + g_re_filterfile = config->re_filterfile; +#endif +#ifdef TRUST_FILES + g_trustfile = config->trustfile; +#endif #endif /* defined(_WIN32) && !defined (_WIN_CONSOLE) */