X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=loadcfg.c;h=5f88d75217a3a47103ac8824956202350688df64;hb=98a5edc74a94e212ae89590798fd1ec0e41d1656;hp=fc6b557da9ef7fc54b9859d51d91382730b591ce;hpb=5110ef0a3098514470b2e2f3c9c89af1c73939c6;p=privoxy.git diff --git a/loadcfg.c b/loadcfg.c index fc6b557d..5f88d752 100644 --- a/loadcfg.c +++ b/loadcfg.c @@ -1,4 +1,4 @@ -const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.105 2009/09/06 14:15:46 fabiankeil Exp $"; +const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.108 2010/01/03 12:37:14 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $ @@ -136,6 +136,7 @@ static struct file_list *current_configfile = NULL; #define hash_confdir 1978389ul /* "confdir" */ #define hash_connection_sharing 1348841265ul /* "connection-sharing" */ #define hash_debug 78263ul /* "debug" */ +#define hash_default_server_timeout 2530089913ul /* "default-server-timeout" */ #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" */ @@ -147,6 +148,7 @@ static struct file_list *current_configfile = NULL; #define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */ #define hash_forward_socks5 3963965522ul /* "forward-socks5" */ #define hash_forwarded_connect_retries 101465292ul /* "forwarded-connect-retries" */ +#define hash_handle_as_empty_returns_ok 1444873247ul /* "handle-as-empty-doc-returns-ok" */ #define hash_hostname 10308071ul /* "hostname" */ #define hash_keep_alive_timeout 3878599515ul /* "keep-alive-timeout" */ #define hash_listen_address 1255650842ul /* "listen-address" */ @@ -358,6 +360,7 @@ struct configuration_spec * load_config(void) config->max_client_connections = 0; config->socket_timeout = 300; /* XXX: Should be a macro. */ #ifdef FEATURE_CONNECTION_KEEP_ALIVE + config->default_server_timeout = 0; config->keep_alive_timeout = DEFAULT_KEEP_ALIVE_TIMEOUT; config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE; config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_SHARING; @@ -365,6 +368,7 @@ struct configuration_spec * load_config(void) config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE; config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS; config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS; + config->feature_flags &= ~RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK; configfp = fopen(configfile, "r"); if (NULL == configfp) @@ -521,6 +525,27 @@ struct configuration_spec * load_config(void) config->debug |= atoi(arg); break; +/* ************************************************************************* + * default-server-timeout timeout + * *************************************************************************/ +#ifdef FEATURE_CONNECTION_KEEP_ALIVE + case hash_default_server_timeout : + if (*arg != '\0') + { + int timeout = atoi(arg); + if (0 < timeout) + { + config->default_server_timeout = (unsigned int)timeout; + } + else + { + log_error(LOG_LEVEL_FATAL, + "Invalid default-server-timeout value: %s", arg); + } + } + break; +#endif + /* ************************************************************************* * deny-access source-ip[/significant-bits] [dest-ip[/significant-bits]] * *************************************************************************/ @@ -888,6 +913,26 @@ struct configuration_spec * load_config(void) config->forwarded_connect_retries = atoi(arg); break; +/* ************************************************************************* + * handle-as-empty-doc-returns-ok 0|1 + * + * Workaround for firefox hanging on blocked javascript pages. + * Block with the "+handle-as-empty-document" flag and set the + * "handle-as-empty-doc-returns-ok" run-time config flag so that + * Privoxy returns a 200/OK status instead of a 403/Forbidden status + * to the browser for blocked pages. + ***************************************************************************/ + case hash_handle_as_empty_returns_ok: + if ((*arg != '\0') && (0 != atoi(arg))) + { + config->feature_flags |= RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK; + } + else + { + config->feature_flags &= ~RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK; + } + break; + /* ************************************************************************* * hostname hostname-to-show-on-cgi-pages * *************************************************************************/ @@ -942,7 +987,7 @@ struct configuration_spec * load_config(void) * In logdir by default * *************************************************************************/ case hash_logfile : - if (!no_daemon) + if (daemon_mode) { logfile = make_path(config->logdir, arg); if (NULL == logfile) @@ -1308,7 +1353,7 @@ struct configuration_spec * load_config(void) freez(config->logfile); - if (!no_daemon) + if (daemon_mode) { if (NULL != logfile) { @@ -1321,6 +1366,16 @@ struct configuration_spec * load_config(void) } } +#ifdef FEATURE_CONNECTION_KEEP_ALIVE + if (config->default_server_timeout > config->keep_alive_timeout) + { + log_error(LOG_LEVEL_ERROR, + "Reducing the default-server-timeout from %d to the keep-alive-timeout %d.", + config->default_server_timeout, config->keep_alive_timeout); + config->default_server_timeout = config->keep_alive_timeout; + } +#endif /* def FEATURE_CONNECTION_KEEP_ALIVE */ + #ifdef FEATURE_CONNECTION_SHARING if (config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE) {