1 const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.117 2011/07/08 13:30:08 fabiankeil Exp $";
2 /*********************************************************************
4 * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
6 * Purpose : Loads settings from the configuration file into
7 * global variables. This file contains both the
8 * routine to load the configuration and the global
9 * variables it writes to.
11 * Copyright : Written by and Copyright (C) 2001-2009 the
12 * Privoxy team. http://www.privoxy.org/
14 * Based on the Internet Junkbuster originally written
15 * by and Copyright (C) 1997 Anonymous Coders and
16 * Junkbusters Corporation. http://www.junkbusters.com
18 * This program is free software; you can redistribute it
19 * and/or modify it under the terms of the GNU General
20 * Public License as published by the Free Software
21 * Foundation; either version 2 of the License, or (at
22 * your option) any later version.
24 * This program is distributed in the hope that it will
25 * be useful, but WITHOUT ANY WARRANTY; without even the
26 * implied warranty of MERCHANTABILITY or FITNESS FOR A
27 * PARTICULAR PURPOSE. See the GNU General Public
28 * License for more details.
30 * The GNU General Public License should be included with
31 * this file. If not, you can view it at
32 * http://www.gnu.org/copyleft/gpl.html
33 * or write to the Free Software Foundation, Inc., 59
34 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 *********************************************************************/
42 #include <sys/types.h>
61 # endif /* ndef _WIN_CONSOLE */
63 #else /* ifndef _WIN32 */
67 # include <sys/wait.h>
69 # include <sys/time.h>
70 # include <sys/stat.h>
88 const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
91 * Fix a problem with Solaris. There should be no effect on other
93 * Solaris's isspace() is a macro which uses it's argument directly
94 * as an array index. Therefore we need to make sure that high-bit
95 * characters generate +ve values, and ideally we also want to make
96 * the argument match the declared parameter type of "int".
98 #define ijb_isupper(__X) isupper((int)(unsigned char)(__X))
99 #define ijb_tolower(__X) tolower((int)(unsigned char)(__X))
101 #ifdef FEATURE_TOGGLE
102 /* Privoxy is enabled by default. */
103 int global_toggle_state = 1;
104 #endif /* def FEATURE_TOGGLE */
106 /* The filename of the configfile */
107 const char *configfile = NULL;
110 * CGI functions will later need access to the invocation args,
111 * so we will make argc and argv global.
114 char * const * Argv = NULL;
116 static struct file_list *current_configfile = NULL;
120 * This takes the "cryptic" hash of each keyword and aliases them to
121 * something a little more readable. This also makes changing the
122 * hash values easier if they should change or the hash algorthm changes.
123 * Use the included "hash" program to find out what the hash will be
124 * for any string supplied on the command line. (Or just put it in the
125 * config file and read the number from the error message in the log).
127 * Please keep this list sorted alphabetically (but with the Windows
128 * console and GUI specific options last).
131 #define hash_actions_file 1196306641ul /* "actionsfile" */
132 #define hash_accept_intercepted_requests 1513024973ul /* "accept-intercepted-requests" */
133 #define hash_admin_address 4112573064ul /* "admin-address" */
134 #define hash_allow_cgi_request_crunching 258915987ul /* "allow-cgi-request-crunching" */
135 #define hash_buffer_limit 1881726070ul /* "buffer-limit */
136 #define hash_compression_level 2464423563ul /* "compression-level" */
137 #define hash_confdir 1978389ul /* "confdir" */
138 #define hash_connection_sharing 1348841265ul /* "connection-sharing" */
139 #define hash_debug 78263ul /* "debug" */
140 #define hash_default_server_timeout 2530089913ul /* "default-server-timeout" */
141 #define hash_deny_access 1227333715ul /* "deny-access" */
142 #define hash_enable_edit_actions 2517097536ul /* "enable-edit-actions" */
143 #define hash_enable_compression 3943696946ul /* "enable-compression" */
144 #define hash_enable_remote_toggle 2979744683ul /* "enable-remote-toggle" */
145 #define hash_enable_remote_http_toggle 110543988ul /* "enable-remote-http-toggle" */
146 #define hash_enforce_blocks 1862427469ul /* "enforce-blocks" */
147 #define hash_filterfile 250887266ul /* "filterfile" */
148 #define hash_forward 2029845ul /* "forward" */
149 #define hash_forward_socks4 3963965521ul /* "forward-socks4" */
150 #define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */
151 #define hash_forward_socks5 3963965522ul /* "forward-socks5" */
152 #define hash_forwarded_connect_retries 101465292ul /* "forwarded-connect-retries" */
153 #define hash_handle_as_empty_returns_ok 1444873247ul /* "handle-as-empty-doc-returns-ok" */
154 #define hash_hostname 10308071ul /* "hostname" */
155 #define hash_keep_alive_timeout 3878599515ul /* "keep-alive-timeout" */
156 #define hash_listen_address 1255650842ul /* "listen-address" */
157 #define hash_logdir 422889ul /* "logdir" */
158 #define hash_logfile 2114766ul /* "logfile" */
159 #define hash_max_client_connections 3595884446ul /* "max-client-connections" */
160 #define hash_permit_access 3587953268ul /* "permit-access" */
161 #define hash_proxy_info_url 3903079059ul /* "proxy-info-url" */
162 #define hash_single_threaded 4250084780ul /* "single-threaded" */
163 #define hash_socket_timeout 1809001761ul /* "socket-timeout" */
164 #define hash_split_large_cgi_forms 671658948ul /* "split-large-cgi-forms" */
165 #define hash_suppress_blocklists 1948693308ul /* "suppress-blocklists" */
166 #define hash_templdir 11067889ul /* "templdir" */
167 #define hash_toggle 447966ul /* "toggle" */
168 #define hash_trust_info_url 430331967ul /* "trust-info-url" */
169 #define hash_trustfile 56494766ul /* "trustfile" */
170 #define hash_usermanual 1416668518ul /* "user-manual" */
171 #define hash_activity_animation 1817904738ul /* "activity-animation" */
172 #define hash_close_button_minimizes 3651284693ul /* "close-button-minimizes" */
173 #define hash_hide_console 2048809870ul /* "hide-console" */
174 #define hash_log_buffer_size 2918070425ul /* "log-buffer-size" */
175 #define hash_log_font_name 2866730124ul /* "log-font-name" */
176 #define hash_log_font_size 2866731014ul /* "log-font-size" */
177 #define hash_log_highlight_messages 4032101240ul /* "log-highlight-messages" */
178 #define hash_log_max_lines 2868344173ul /* "log-max-lines" */
179 #define hash_log_messages 2291744899ul /* "log-messages" */
180 #define hash_show_on_task_bar 215410365ul /* "show-on-task-bar" */
183 static void savearg(char *command, char *argument, struct configuration_spec * config);
185 /*********************************************************************
187 * Function : unload_configfile
189 * Description : Free the config structure and all components.
192 * 1 : data: struct configuration_spec to unload
196 *********************************************************************/
197 static void unload_configfile (void * data)
199 struct configuration_spec * config = (struct configuration_spec *)data;
200 struct forward_spec *cur_fwd = config->forward;
204 struct access_control_list *cur_acl = config->acl;
206 while (cur_acl != NULL)
208 struct access_control_list * next_acl = cur_acl->next;
213 #endif /* def FEATURE_ACL */
215 while (cur_fwd != NULL)
217 struct forward_spec * next_fwd = cur_fwd->next;
218 free_url_spec(cur_fwd->url);
220 freez(cur_fwd->gateway_host);
221 freez(cur_fwd->forward_host);
225 config->forward = NULL;
227 freez(config->confdir);
228 freez(config->logdir);
229 freez(config->templdir);
230 freez(config->hostname);
232 for (i = 0; i < MAX_LISTENING_SOCKETS; i++)
234 freez(config->haddr[i]);
236 freez(config->logfile);
238 for (i = 0; i < MAX_AF_FILES; i++)
240 freez(config->actions_file_short[i]);
241 freez(config->actions_file[i]);
242 freez(config->re_filterfile_short[i]);
243 freez(config->re_filterfile[i]);
246 freez(config->admin_address);
247 freez(config->proxy_info_url);
248 freez(config->proxy_args);
249 freez(config->usermanual);
252 freez(config->trustfile);
253 list_remove_all(config->trust_info);
254 #endif /* def FEATURE_TRUST */
260 #ifdef FEATURE_GRACEFUL_TERMINATION
261 /*********************************************************************
263 * Function : unload_current_config_file
265 * Description : Unloads current config file - reset to state at
266 * beginning of program.
272 *********************************************************************/
273 void unload_current_config_file(void)
275 if (current_configfile)
277 current_configfile->unloader = unload_configfile;
278 current_configfile = NULL;
284 /*********************************************************************
286 * Function : parse_toggle_value
288 * Description : Parse the value of a directive that can only be
289 * enabled or disabled. Terminates with a fatal error
290 * if the value is NULL or something other than 0 or 1.
293 * 1 : name: The name of the directive. Used for log messages.
294 * 2 : value: The value to parse
297 * Returns : The numerical toggle state
299 *********************************************************************/
300 static int parse_toggle_state(const char *name, const char *value)
303 assert(name != NULL);
304 assert(value != NULL);
306 if ((value == NULL) || (*value == '\0'))
308 log_error(LOG_LEVEL_FATAL, "Directive %s used without argument", name);
311 toggle_state = atoi(value);
314 * Also check the length as atoi() doesn't mind
315 * garbage after a valid integer, but we do.
317 if (((toggle_state != 0) && (toggle_state != 1)) || (strlen(value) != 1))
319 log_error(LOG_LEVEL_FATAL,
320 "Directive %s used with invalid argument '%s'. Use either '0' or '1'.",
329 /*********************************************************************
331 * Function : load_config
333 * Description : Load the config file and all parameters.
335 * XXX: more than thousand lines long
336 * and thus in serious need of refactoring.
340 * Returns : The configuration_spec, or NULL on error.
342 *********************************************************************/
343 struct configuration_spec * load_config(void)
347 FILE *configfp = NULL;
348 struct configuration_spec * config = NULL;
349 struct client_state * fake_csp;
350 struct file_list *fs;
351 unsigned long linenum = 0;
353 char *logfile = NULL;
355 if (!check_file_changed(current_configfile, configfile, &fs))
357 /* No need to load */
358 return ((struct configuration_spec *)current_configfile->f);
362 log_error(LOG_LEVEL_FATAL,
363 "can't check configuration file '%s': %E", configfile);
367 if (NULL != current_configfile)
369 log_error(LOG_LEVEL_INFO, "Reloading configuration file '%s'", configfile);
372 #ifdef FEATURE_TOGGLE
373 global_toggle_state = 1;
374 #endif /* def FEATURE_TOGGLE */
376 fs->f = config = (struct configuration_spec *)zalloc(sizeof(*config));
382 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
387 * This is backwards from how it's usually done.
388 * Following the usual pattern, "fs" would be stored in a member
389 * variable in "csp", and then we'd access "config" from "fs->f",
390 * using a cast. However, "config" is used so often that a
391 * cast each time would be very ugly, and the extra indirection
392 * would waste CPU cycles. Therefore we store "config" in
393 * "csp->config", and "fs" in "csp->config->config_file_list".
395 config->config_file_list = fs;
400 config->multi_threaded = 1;
401 config->buffer_limit = 4096 * 1024;
402 config->usermanual = strdup(USER_MANUAL_URL);
403 config->proxy_args = strdup("");
404 config->forwarded_connect_retries = 0;
405 config->max_client_connections = 0;
406 config->socket_timeout = 300; /* XXX: Should be a macro. */
407 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
408 config->default_server_timeout = 0;
409 config->keep_alive_timeout = DEFAULT_KEEP_ALIVE_TIMEOUT;
410 config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE;
411 config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_SHARING;
413 config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE;
414 config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
415 config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS;
416 config->feature_flags &= ~RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK;
417 #ifdef FEATURE_COMPRESSION
418 config->feature_flags &= ~RUNTIME_FEATURE_COMPRESSION;
420 * XXX: Run some benchmarks to see if there are better default values.
422 config->compression_level = 1;
425 configfp = fopen(configfile, "r");
426 if (NULL == configfp)
428 log_error(LOG_LEVEL_FATAL,
429 "can't open configuration file '%s': %E", configfile);
430 /* Never get here - LOG_LEVEL_FATAL causes program exit */
433 while (read_config_line(configfp, &linenum, &buf) != NULL)
435 char cmd[BUFFER_SIZE];
436 char arg[BUFFER_SIZE];
437 char tmp[BUFFER_SIZE];
439 struct access_control_list *cur_acl;
440 #endif /* def FEATURE_ACL */
441 struct forward_spec *cur_fwd;
444 unsigned long directive_hash;
446 strlcpy(tmp, buf, sizeof(tmp));
448 /* Copy command (i.e. up to space or tab) into cmd */
451 while (*p && (*p != ' ') && (*p != '\t'))
457 /* Skip over the whitespace in buf */
458 while (*p && ((*p == ' ') || (*p == '\t')))
463 /* Copy the argument into arg */
464 if (strlcpy(arg, p, sizeof(arg)) >= sizeof(arg))
466 log_error(LOG_LEVEL_FATAL, "Config line too long: %s", buf);
469 /* Should never happen, but check this anyway */
476 /* Make sure the command field is lower case */
477 for (p = cmd; *p; p++)
481 *p = (char)ijb_tolower(*p);
485 directive_hash = hash_string(cmd);
486 switch (directive_hash)
488 /* *************************************************************************
489 * actionsfile actions-file-name
490 * In confdir by default
491 * *************************************************************************/
492 case hash_actions_file :
494 while ((i < MAX_AF_FILES) && (NULL != config->actions_file[i]))
499 if (i >= MAX_AF_FILES)
501 log_error(LOG_LEVEL_FATAL, "Too many 'actionsfile' directives in config file - limit is %d.\n"
502 "(You can increase this limit by changing MAX_AF_FILES in project.h and recompiling).",
505 config->actions_file_short[i] = strdup(arg);
506 config->actions_file[i] = make_path(config->confdir, arg);
509 /* *************************************************************************
510 * accept-intercepted-requests
511 * *************************************************************************/
512 case hash_accept_intercepted_requests:
513 if (parse_toggle_state(cmd, arg) == 1)
515 config->feature_flags |= RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS;
519 config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS;
523 /* *************************************************************************
524 * admin-address email-address
525 * *************************************************************************/
526 case hash_admin_address :
527 freez(config->admin_address);
528 config->admin_address = strdup(arg);
531 /* *************************************************************************
532 * allow-cgi-request-crunching
533 * *************************************************************************/
534 case hash_allow_cgi_request_crunching:
535 if (parse_toggle_state(cmd, arg) == 1)
537 config->feature_flags |= RUNTIME_FEATURE_CGI_CRUNCHING;
541 config->feature_flags &= ~RUNTIME_FEATURE_CGI_CRUNCHING;
545 /* *************************************************************************
547 * *************************************************************************/
548 case hash_buffer_limit :
549 config->buffer_limit = (size_t)(1024 * atoi(arg));
552 /* *************************************************************************
553 * confdir directory-name
554 * *************************************************************************/
556 freez(config->confdir);
557 config->confdir = make_path( NULL, arg);
560 /* *************************************************************************
561 * compression-level 0-9
562 * *************************************************************************/
563 #ifdef FEATURE_COMPRESSION
564 case hash_compression_level :
567 int compression_level = atoi(arg);
568 if (-1 <= compression_level && compression_level <= 9)
570 config->compression_level = compression_level;;
574 log_error(LOG_LEVEL_FATAL,
575 "Invalid compression-level value: %s", arg);
580 log_error(LOG_LEVEL_FATAL,
581 "Invalid compression-level directive. Compression value missing");
586 /* *************************************************************************
587 * connection-sharing (0|1)
588 * *************************************************************************/
589 #ifdef FEATURE_CONNECTION_SHARING
590 case hash_connection_sharing :
591 if (parse_toggle_state(cmd, arg) == 1)
593 config->feature_flags |= RUNTIME_FEATURE_CONNECTION_SHARING;
597 config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_SHARING;
602 /* *************************************************************************
604 * Specifies debug level, multiple values are ORed together.
605 * *************************************************************************/
607 config->debug |= atoi(arg);
610 /* *************************************************************************
611 * default-server-timeout timeout
612 * *************************************************************************/
613 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
614 case hash_default_server_timeout :
617 int timeout = atoi(arg);
620 config->default_server_timeout = (unsigned int)timeout;
624 log_error(LOG_LEVEL_FATAL,
625 "Invalid default-server-timeout value: %s", arg);
631 /* *************************************************************************
632 * deny-access source-ip[/significant-bits] [dest-ip[/significant-bits]]
633 * *************************************************************************/
635 case hash_deny_access:
636 strlcpy(tmp, arg, sizeof(tmp));
637 vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
639 if ((vec_count != 1) && (vec_count != 2))
641 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
642 "deny-access directive in configuration file.");
643 string_append(&config->proxy_args,
644 "<br>\nWARNING: Wrong number of parameters for "
645 "deny-access directive in configuration file.<br><br>\n");
649 /* allocate a new node */
650 cur_acl = (struct access_control_list *) zalloc(sizeof(*cur_acl));
654 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
655 /* Never get here - LOG_LEVEL_FATAL causes program exit */
658 cur_acl->action = ACL_DENY;
660 if (acl_addr(vec[0], cur_acl->src) < 0)
662 log_error(LOG_LEVEL_ERROR, "Invalid source address, port or netmask "
663 "for deny-access directive in configuration file: \"%s\"", vec[0]);
664 string_append(&config->proxy_args,
665 "<br>\nWARNING: Invalid source address, port or netmask "
666 "for deny-access directive in configuration file: \"");
667 string_append(&config->proxy_args,
669 string_append(&config->proxy_args,
676 if (acl_addr(vec[1], cur_acl->dst) < 0)
678 log_error(LOG_LEVEL_ERROR, "Invalid destination address, port or netmask "
679 "for deny-access directive in configuration file: \"%s\"", vec[1]);
680 string_append(&config->proxy_args,
681 "<br>\nWARNING: Invalid destination address, port or netmask "
682 "for deny-access directive in configuration file: \"");
683 string_append(&config->proxy_args,
685 string_append(&config->proxy_args,
694 cur_acl->wildcard_dst = 1;
696 #endif /* def HAVE_RFC2553 */
699 * Add it to the list. Note we reverse the list to get the
700 * behaviour the user expects. With both the ACL and
701 * actions file, the last match wins. However, the internal
702 * implementations are different: The actions file is stored
703 * in the same order as the file, and scanned completely.
704 * With the ACL, we reverse the order as we load it, then
705 * when we scan it we stop as soon as we get a match.
707 cur_acl->next = config->acl;
708 config->acl = cur_acl;
711 #endif /* def FEATURE_ACL */
713 /* *************************************************************************
714 * enable-edit-actions 0|1
715 * *************************************************************************/
716 #ifdef FEATURE_CGI_EDIT_ACTIONS
717 case hash_enable_edit_actions:
718 if (parse_toggle_state(cmd, arg) == 1)
720 config->feature_flags |= RUNTIME_FEATURE_CGI_EDIT_ACTIONS;
724 config->feature_flags &= ~RUNTIME_FEATURE_CGI_EDIT_ACTIONS;
727 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
729 /* *************************************************************************
730 * enable-compression 0|1
731 * *************************************************************************/
732 #ifdef FEATURE_COMPRESSION
733 case hash_enable_compression:
734 if (parse_toggle_state(cmd, arg) == 1)
736 config->feature_flags |= RUNTIME_FEATURE_COMPRESSION;
740 config->feature_flags &= ~RUNTIME_FEATURE_COMPRESSION;
743 #endif /* def FEATURE_COMPRESSION */
746 /* *************************************************************************
747 * enable-remote-toggle 0|1
748 * *************************************************************************/
749 #ifdef FEATURE_TOGGLE
750 case hash_enable_remote_toggle:
751 if (parse_toggle_state(cmd, arg) == 1)
753 config->feature_flags |= RUNTIME_FEATURE_CGI_TOGGLE;
757 config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE;
760 #endif /* def FEATURE_TOGGLE */
762 /* *************************************************************************
763 * enable-remote-http-toggle 0|1
764 * *************************************************************************/
765 case hash_enable_remote_http_toggle:
766 if (parse_toggle_state(cmd, arg) == 1)
768 config->feature_flags |= RUNTIME_FEATURE_HTTP_TOGGLE;
772 config->feature_flags &= ~RUNTIME_FEATURE_HTTP_TOGGLE;
776 /* *************************************************************************
778 * *************************************************************************/
779 case hash_enforce_blocks:
780 #ifdef FEATURE_FORCE_LOAD
781 if (parse_toggle_state(cmd, arg) == 1)
783 config->feature_flags |= RUNTIME_FEATURE_ENFORCE_BLOCKS;
787 config->feature_flags &= ~RUNTIME_FEATURE_ENFORCE_BLOCKS;
790 log_error(LOG_LEVEL_ERROR, "Ignoring directive 'enforce-blocks'. "
791 "FEATURE_FORCE_LOAD is disabled, blocks will always be enforced.");
792 #endif /* def FEATURE_FORCE_LOAD */
795 /* *************************************************************************
796 * filterfile file-name
797 * In confdir by default.
798 * *************************************************************************/
799 case hash_filterfile :
801 while ((i < MAX_AF_FILES) && (NULL != config->re_filterfile[i]))
806 if (i >= MAX_AF_FILES)
808 log_error(LOG_LEVEL_FATAL, "Too many 'filterfile' directives in config file - limit is %d.\n"
809 "(You can increase this limit by changing MAX_AF_FILES in project.h and recompiling).",
812 config->re_filterfile_short[i] = strdup(arg);
813 config->re_filterfile[i] = make_path(config->confdir, arg);
817 /* *************************************************************************
818 * forward url-pattern (.|http-proxy-host[:port])
819 * *************************************************************************/
821 strlcpy(tmp, arg, sizeof(tmp));
822 vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
826 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for forward "
827 "directive in configuration file.");
828 string_append(&config->proxy_args,
829 "<br>\nWARNING: Wrong number of parameters for "
830 "forward directive in configuration file.");
834 /* allocate a new node */
835 cur_fwd = zalloc(sizeof(*cur_fwd));
838 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
839 /* Never get here - LOG_LEVEL_FATAL causes program exit */
843 cur_fwd->type = SOCKS_NONE;
845 /* Save the URL pattern */
846 if (create_url_spec(cur_fwd->url, vec[0]))
848 log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward "
849 "directive in configuration file.");
850 string_append(&config->proxy_args,
851 "<br>\nWARNING: Bad URL specifier for "
852 "forward directive in configuration file.");
856 /* Parse the parent HTTP proxy host:port */
859 if (strcmp(p, ".") != 0)
861 cur_fwd->forward_port = 8000;
862 parse_forwarder_address(p, &cur_fwd->forward_host,
863 &cur_fwd->forward_port);
867 cur_fwd->next = config->forward;
868 config->forward = cur_fwd;
872 /* *************************************************************************
873 * forward-socks4 url-pattern socks-proxy[:port] (.|http-proxy[:port])
874 * *************************************************************************/
875 case hash_forward_socks4:
876 strlcpy(tmp, arg, sizeof(tmp));
877 vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
881 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
882 "forward-socks4 directive in configuration file.");
883 string_append(&config->proxy_args,
884 "<br>\nWARNING: Wrong number of parameters for "
885 "forward-socks4 directive in configuration file.");
889 /* allocate a new node */
890 cur_fwd = zalloc(sizeof(*cur_fwd));
893 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
894 /* Never get here - LOG_LEVEL_FATAL causes program exit */
898 cur_fwd->type = SOCKS_4;
900 /* Save the URL pattern */
901 if (create_url_spec(cur_fwd->url, vec[0]))
903 log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward-socks4 "
904 "directive in configuration file.");
905 string_append(&config->proxy_args,
906 "<br>\nWARNING: Bad URL specifier for "
907 "forward-socks4 directive in configuration file.");
911 /* Parse the SOCKS proxy host[:port] */
914 /* XXX: This check looks like a bug. */
915 if (strcmp(p, ".") != 0)
917 cur_fwd->gateway_port = 1080;
918 parse_forwarder_address(p, &cur_fwd->gateway_host,
919 &cur_fwd->gateway_port);
922 /* Parse the parent HTTP proxy host[:port] */
925 if (strcmp(p, ".") != 0)
927 cur_fwd->forward_port = 8000;
928 parse_forwarder_address(p, &cur_fwd->forward_host,
929 &cur_fwd->forward_port);
933 cur_fwd->next = config->forward;
934 config->forward = cur_fwd;
938 /* *************************************************************************
939 * forward-socks4a url-pattern socks-proxy[:port] (.|http-proxy[:port])
940 * *************************************************************************/
941 case hash_forward_socks4a:
942 case hash_forward_socks5:
943 strlcpy(tmp, arg, sizeof(tmp));
944 vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
948 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
949 "forward-socks4a directive in configuration file.");
950 string_append(&config->proxy_args,
951 "<br>\nWARNING: Wrong number of parameters for "
952 "forward-socks4a directive in configuration file.");
956 /* allocate a new node */
957 cur_fwd = zalloc(sizeof(*cur_fwd));
960 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
961 /* Never get here - LOG_LEVEL_FATAL causes program exit */
965 if (directive_hash == hash_forward_socks4a)
967 cur_fwd->type = SOCKS_4A;
971 cur_fwd->type = SOCKS_5;
974 /* Save the URL pattern */
975 if (create_url_spec(cur_fwd->url, vec[0]))
977 log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward-socks4a "
978 "directive in configuration file.");
979 string_append(&config->proxy_args,
980 "<br>\nWARNING: Bad URL specifier for "
981 "forward-socks4a directive in configuration file.");
985 /* Parse the SOCKS proxy host[:port] */
988 cur_fwd->gateway_port = 1080;
989 parse_forwarder_address(p, &cur_fwd->gateway_host,
990 &cur_fwd->gateway_port);
992 /* Parse the parent HTTP proxy host[:port] */
995 if (strcmp(p, ".") != 0)
997 cur_fwd->forward_port = 8000;
998 parse_forwarder_address(p, &cur_fwd->forward_host,
999 &cur_fwd->forward_port);
1003 cur_fwd->next = config->forward;
1004 config->forward = cur_fwd;
1008 /* *************************************************************************
1009 * forwarded-connect-retries n
1010 * *************************************************************************/
1011 case hash_forwarded_connect_retries :
1012 config->forwarded_connect_retries = atoi(arg);
1015 /* *************************************************************************
1016 * handle-as-empty-doc-returns-ok 0|1
1018 * Workaround for firefox hanging on blocked javascript pages.
1019 * Block with the "+handle-as-empty-document" flag and set the
1020 * "handle-as-empty-doc-returns-ok" run-time config flag so that
1021 * Privoxy returns a 200/OK status instead of a 403/Forbidden status
1022 * to the browser for blocked pages.
1023 ***************************************************************************/
1024 case hash_handle_as_empty_returns_ok:
1025 if (parse_toggle_state(cmd, arg) == 1)
1027 config->feature_flags |= RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK;
1031 config->feature_flags &= ~RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK;
1035 /* *************************************************************************
1036 * hostname hostname-to-show-on-cgi-pages
1037 * *************************************************************************/
1038 case hash_hostname :
1039 freez(config->hostname);
1040 config->hostname = strdup(arg);
1041 if (NULL == config->hostname)
1043 log_error(LOG_LEVEL_FATAL, "Out of memory saving hostname.");
1047 /* *************************************************************************
1048 * keep-alive-timeout timeout
1049 * *************************************************************************/
1050 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
1051 case hash_keep_alive_timeout :
1054 int timeout = atoi(arg);
1057 config->feature_flags |= RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE;
1058 config->keep_alive_timeout = (unsigned int)timeout;
1062 config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE;
1068 /* *************************************************************************
1069 * listen-address [ip][:port]
1070 * *************************************************************************/
1071 case hash_listen_address :
1073 while ((i < MAX_LISTENING_SOCKETS) && (NULL != config->haddr[i]))
1078 if (i >= MAX_LISTENING_SOCKETS)
1080 log_error(LOG_LEVEL_FATAL, "Too many 'listen-address' directives in config file - limit is %d.\n"
1081 "(You can increase this limit by changing MAX_LISTENING_SOCKETS in project.h and recompiling).",
1082 MAX_LISTENING_SOCKETS);
1084 config->haddr[i] = strdup(arg);
1085 if (NULL == config->haddr[i])
1087 log_error(LOG_LEVEL_FATAL, "Out of memory while copying listening address");
1091 /* *************************************************************************
1092 * logdir directory-name
1093 * *************************************************************************/
1095 freez(config->logdir);
1096 config->logdir = make_path(NULL, arg);
1099 /* *************************************************************************
1100 * logfile log-file-name
1101 * In logdir by default
1102 * *************************************************************************/
1106 logfile = make_path(config->logdir, arg);
1107 if (NULL == logfile)
1109 log_error(LOG_LEVEL_FATAL, "Out of memory while creating logfile path");
1114 /* *************************************************************************
1115 * max-client-connections number
1116 * *************************************************************************/
1117 case hash_max_client_connections :
1120 int max_client_connections = atoi(arg);
1121 if (0 <= max_client_connections)
1123 config->max_client_connections = max_client_connections;
1128 /* *************************************************************************
1129 * permit-access source-ip[/significant-bits] [dest-ip[/significant-bits]]
1130 * *************************************************************************/
1132 case hash_permit_access:
1133 strlcpy(tmp, arg, sizeof(tmp));
1134 vec_count = ssplit(tmp, " \t", vec, SZ(vec), 1, 1);
1136 if ((vec_count != 1) && (vec_count != 2))
1138 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
1139 "permit-access directive in configuration file.");
1140 string_append(&config->proxy_args,
1141 "<br>\nWARNING: Wrong number of parameters for "
1142 "permit-access directive in configuration file.<br><br>\n");
1147 /* allocate a new node */
1148 cur_acl = (struct access_control_list *) zalloc(sizeof(*cur_acl));
1150 if (cur_acl == NULL)
1152 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
1153 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1156 cur_acl->action = ACL_PERMIT;
1158 if (acl_addr(vec[0], cur_acl->src) < 0)
1160 log_error(LOG_LEVEL_ERROR, "Invalid source address, port or netmask "
1161 "for permit-access directive in configuration file: \"%s\"", vec[0]);
1162 string_append(&config->proxy_args,
1163 "<br>\nWARNING: Invalid source address, port or netmask for "
1164 "permit-access directive in configuration file: \"");
1165 string_append(&config->proxy_args,
1167 string_append(&config->proxy_args,
1174 if (acl_addr(vec[1], cur_acl->dst) < 0)
1176 log_error(LOG_LEVEL_ERROR, "Invalid destination address, port or netmask "
1177 "for permit-access directive in configuration file: \"%s\"", vec[1]);
1178 string_append(&config->proxy_args,
1179 "<br>\nWARNING: Invalid destination address, port or netmask for "
1180 "permit-access directive in configuration file: \"");
1181 string_append(&config->proxy_args,
1183 string_append(&config->proxy_args,
1192 cur_acl->wildcard_dst = 1;
1194 #endif /* def HAVE_RFC2553 */
1197 * Add it to the list. Note we reverse the list to get the
1198 * behaviour the user expects. With both the ACL and
1199 * actions file, the last match wins. However, the internal
1200 * implementations are different: The actions file is stored
1201 * in the same order as the file, and scanned completely.
1202 * With the ACL, we reverse the order as we load it, then
1203 * when we scan it we stop as soon as we get a match.
1205 cur_acl->next = config->acl;
1206 config->acl = cur_acl;
1209 #endif /* def FEATURE_ACL */
1211 /* *************************************************************************
1212 * proxy-info-url url
1213 * *************************************************************************/
1214 case hash_proxy_info_url :
1215 freez(config->proxy_info_url);
1216 config->proxy_info_url = strdup(arg);
1219 /* *************************************************************************
1221 * *************************************************************************/
1222 case hash_single_threaded :
1223 config->multi_threaded = 0;
1226 /* *************************************************************************
1227 * socket-timeout numer_of_seconds
1228 * *************************************************************************/
1229 case hash_socket_timeout :
1232 int socket_timeout = atoi(arg);
1233 if (0 < socket_timeout)
1235 config->socket_timeout = socket_timeout;
1239 log_error(LOG_LEVEL_FATAL,
1240 "Invalid socket-timeout: '%s'", arg);
1245 /* *************************************************************************
1246 * split-large-cgi-forms
1247 * *************************************************************************/
1248 case hash_split_large_cgi_forms :
1249 if (parse_toggle_state(cmd, arg) == 1)
1251 config->feature_flags |= RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
1255 config->feature_flags &= ~RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
1259 /* *************************************************************************
1260 * templdir directory-name
1261 * *************************************************************************/
1262 case hash_templdir :
1263 freez(config->templdir);
1264 config->templdir = make_path(NULL, arg);
1267 /* *************************************************************************
1269 * *************************************************************************/
1270 #ifdef FEATURE_TOGGLE
1272 global_toggle_state = atoi(arg);
1274 #endif /* def FEATURE_TOGGLE */
1276 /* *************************************************************************
1277 * trust-info-url url
1278 * *************************************************************************/
1279 #ifdef FEATURE_TRUST
1280 case hash_trust_info_url :
1281 enlist(config->trust_info, arg);
1283 #endif /* def FEATURE_TRUST */
1285 /* *************************************************************************
1286 * trustfile filename
1287 * (In confdir by default.)
1288 * *************************************************************************/
1289 #ifdef FEATURE_TRUST
1290 case hash_trustfile :
1291 freez(config->trustfile);
1292 config->trustfile = make_path(config->confdir, arg);
1294 #endif /* def FEATURE_TRUST */
1296 /* *************************************************************************
1298 * *************************************************************************/
1299 case hash_usermanual :
1301 * XXX: If this isn't the first config directive, the
1302 * show-status page links to the website documentation
1303 * for the directives that were already parsed. Lame.
1305 freez(config->usermanual);
1306 config->usermanual = strdup(arg);
1309 /* *************************************************************************
1310 * Win32 Console options:
1311 * *************************************************************************/
1313 /* *************************************************************************
1315 * *************************************************************************/
1317 case hash_hide_console :
1320 #endif /*def _WIN_CONSOLE*/
1323 /* *************************************************************************
1324 * Win32 GUI options:
1325 * *************************************************************************/
1327 #if defined(_WIN32) && ! defined(_WIN_CONSOLE)
1328 /* *************************************************************************
1329 * activity-animation (0|1)
1330 * *************************************************************************/
1331 case hash_activity_animation :
1332 g_bShowActivityAnimation = atoi(arg);
1335 /* *************************************************************************
1336 * close-button-minimizes (0|1)
1337 * *************************************************************************/
1338 case hash_close_button_minimizes :
1339 g_bCloseHidesWindow = atoi(arg);
1342 /* *************************************************************************
1343 * log-buffer-size (0|1)
1344 * *************************************************************************/
1345 case hash_log_buffer_size :
1346 g_bLimitBufferSize = atoi(arg);
1349 /* *************************************************************************
1350 * log-font-name fontname
1351 * *************************************************************************/
1352 case hash_log_font_name :
1353 if (strlcpy(g_szFontFaceName, arg,
1354 sizeof(g_szFontFaceName)) >= sizeof(g_szFontFaceName))
1356 log_error(LOG_LEVEL_FATAL,
1357 "log-font-name argument '%s' is longer than %u characters.",
1358 arg, sizeof(g_szFontFaceName)-1);
1362 /* *************************************************************************
1364 * *************************************************************************/
1365 case hash_log_font_size :
1366 g_nFontSize = atoi(arg);
1369 /* *************************************************************************
1370 * log-highlight-messages (0|1)
1371 * *************************************************************************/
1372 case hash_log_highlight_messages :
1373 g_bHighlightMessages = atoi(arg);
1376 /* *************************************************************************
1378 * *************************************************************************/
1379 case hash_log_max_lines :
1380 g_nMaxBufferLines = atoi(arg);
1383 /* *************************************************************************
1384 * log-messages (0|1)
1385 * *************************************************************************/
1386 case hash_log_messages :
1387 g_bLogMessages = atoi(arg);
1390 /* *************************************************************************
1391 * show-on-task-bar (0|1)
1392 * *************************************************************************/
1393 case hash_show_on_task_bar :
1394 g_bShowOnTaskBar = atoi(arg);
1397 #endif /* defined(_WIN32) && ! defined(_WIN_CONSOLE) */
1400 /* *************************************************************************
1401 * Warnings about unsupported features
1402 * *************************************************************************/
1404 case hash_deny_access:
1405 #endif /* ndef FEATURE_ACL */
1406 #ifndef FEATURE_CGI_EDIT_ACTIONS
1407 case hash_enable_edit_actions:
1408 #endif /* ndef FEATURE_CGI_EDIT_ACTIONS */
1409 #ifndef FEATURE_TOGGLE
1410 case hash_enable_remote_toggle:
1411 #endif /* ndef FEATURE_TOGGLE */
1413 case hash_permit_access:
1414 #endif /* ndef FEATURE_ACL */
1415 #ifndef FEATURE_TOGGLE
1417 #endif /* ndef FEATURE_TOGGLE */
1418 #ifndef FEATURE_TRUST
1419 case hash_trustfile :
1420 case hash_trust_info_url :
1421 #endif /* ndef FEATURE_TRUST */
1423 #ifndef _WIN_CONSOLE
1424 case hash_hide_console :
1425 #endif /* ndef _WIN_CONSOLE */
1427 #if defined(_WIN_CONSOLE) || ! defined(_WIN32)
1428 case hash_activity_animation :
1429 case hash_close_button_minimizes :
1430 case hash_log_buffer_size :
1431 case hash_log_font_name :
1432 case hash_log_font_size :
1433 case hash_log_highlight_messages :
1434 case hash_log_max_lines :
1435 case hash_log_messages :
1436 case hash_show_on_task_bar :
1437 #endif /* defined(_WIN_CONSOLE) || ! defined(_WIN32) */
1438 /* These warnings are annoying - so hide them. -- Jon */
1439 /* log_error(LOG_LEVEL_INFO, "Unsupported directive \"%s\" ignored.", cmd); */
1442 /* *************************************************************************/
1444 /* *************************************************************************/
1446 * I decided that I liked this better as a warning than an
1447 * error. To change back to an error, just change log level
1448 * to LOG_LEVEL_FATAL.
1450 log_error(LOG_LEVEL_ERROR, "Ignoring unrecognized directive '%s' (%luul) in line %lu "
1451 "in configuration file (%s).", buf, directive_hash, linenum, configfile);
1452 string_append(&config->proxy_args,
1453 " <strong class='warning'>Warning: Ignoring unrecognized directive:</strong>");
1456 /* *************************************************************************/
1457 } /* end switch( hash_string(cmd) ) */
1459 /* Save the argument for the show-status page. */
1460 savearg(cmd, arg, config);
1462 } /* end while ( read_config_line(...) ) */
1466 set_debug_level(config->debug);
1468 freez(config->logfile);
1472 if (NULL != logfile)
1474 config->logfile = logfile;
1475 init_error_log(Argv[0], config->logfile);
1483 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
1484 if (config->default_server_timeout > config->keep_alive_timeout)
1486 log_error(LOG_LEVEL_ERROR,
1487 "Reducing the default-server-timeout from %d to the keep-alive-timeout %d.",
1488 config->default_server_timeout, config->keep_alive_timeout);
1489 config->default_server_timeout = config->keep_alive_timeout;
1491 #endif /* def FEATURE_CONNECTION_KEEP_ALIVE */
1493 #ifdef FEATURE_CONNECTION_SHARING
1494 if (config->feature_flags & RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE)
1496 if (config->multi_threaded)
1498 set_keep_alive_timeout(config->keep_alive_timeout);
1503 * While we could use keep-alive without multiple threads
1504 * if we didn't bother with enforcing the connection timeout,
1505 * that might make Tor users sad, even though they shouldn't
1506 * enable the single-threaded option anyway.
1508 * XXX: We could still use Proxy-Connection: keep-alive.
1510 config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_KEEP_ALIVE;
1511 log_error(LOG_LEVEL_ERROR,
1512 "Config option single-threaded disables connection keep-alive.");
1515 else if ((config->feature_flags & RUNTIME_FEATURE_CONNECTION_SHARING))
1517 log_error(LOG_LEVEL_ERROR, "Config option connection-sharing "
1518 "has no effect if keep-alive-timeout isn't set.");
1519 config->feature_flags &= ~RUNTIME_FEATURE_CONNECTION_SHARING;
1521 #endif /* def FEATURE_CONNECTION_SHARING */
1523 if (NULL == config->proxy_args)
1525 log_error(LOG_LEVEL_FATAL, "Out of memory loading config - insufficient memory for config->proxy_args");
1528 if (config->actions_file[0])
1530 add_loader(load_action_files, config);
1533 if (config->re_filterfile[0])
1535 add_loader(load_re_filterfiles, config);
1538 #ifdef FEATURE_TRUST
1539 if (config->trustfile)
1541 add_loader(load_trustfile, config);
1543 #endif /* def FEATURE_TRUST */
1545 if ( NULL == config->haddr[0] )
1547 config->haddr[0] = strdup( HADDR_DEFAULT );
1548 if (NULL == config->haddr[0])
1550 log_error(LOG_LEVEL_FATAL, "Out of memory while copying default listening address");
1554 for (i = 0; i < MAX_LISTENING_SOCKETS && NULL != config->haddr[i]; i++ )
1556 if ((*config->haddr[i] == '[')
1557 && (NULL != (p = strchr(config->haddr[i], ']')))
1559 && (0 < (config->hport[i] = atoi(p + 2))))
1562 memmove((void *)config->haddr[i], config->haddr[i] + 1,
1563 (size_t)(p - config->haddr[i]));
1565 else if (NULL != (p = strchr(config->haddr[i], ':'))
1566 && (0 < (config->hport[i] = atoi(p + 1))))
1572 log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", config->haddr[i]);
1573 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1575 if (*config->haddr[i] == '\0')
1578 * Only the port specified. We stored it in config->hport[i]
1579 * and don't need its text representation anymore.
1580 * Use config->hport[i] == 0 to iterate listening addresses since
1583 freez(config->haddr[i]);
1588 * Want to run all the loaders once now.
1590 * Need to set up a fake csp, so they can get to the config.
1592 fake_csp = (struct client_state *) zalloc (sizeof(*fake_csp));
1593 fake_csp->config = config;
1595 if (run_loader(fake_csp))
1598 log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");
1599 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1603 /* FIXME: this is a kludge for win32 */
1604 #if defined(_WIN32) && !defined (_WIN_CONSOLE)
1606 g_default_actions_file = config->actions_file[1]; /* FIXME Hope this is default.action */
1607 g_user_actions_file = config->actions_file[2]; /* FIXME Hope this is user.action */
1608 g_default_filterfile = config->re_filterfile[0]; /* FIXME Hope this is default.filter */
1609 g_user_filterfile = config->re_filterfile[1]; /* FIXME Hope this is user.filter */
1611 #ifdef FEATURE_TRUST
1612 g_trustfile = config->trustfile;
1613 #endif /* def FEATURE_TRUST */
1616 #endif /* defined(_WIN32) && !defined (_WIN_CONSOLE) */
1617 /* FIXME: end kludge */
1620 config->need_bind = 1;
1622 if (current_configfile)
1624 struct configuration_spec * oldcfg = (struct configuration_spec *)
1625 current_configfile->f;
1627 * Check if config->haddr[i],hport[i] == oldcfg->haddr[i],hport[i]
1629 * The following could be written more compactly as a single,
1630 * (unreadably long) if statement.
1632 config->need_bind = 0;
1634 for (i = 0; i < MAX_LISTENING_SOCKETS; i++)
1636 if (config->hport[i] != oldcfg->hport[i])
1638 config->need_bind = 1;
1640 else if (config->haddr[i] == NULL)
1642 if (oldcfg->haddr[i] != NULL)
1644 config->need_bind = 1;
1647 else if (oldcfg->haddr[i] == NULL)
1649 config->need_bind = 1;
1651 else if (0 != strcmp(config->haddr[i], oldcfg->haddr[i]))
1653 config->need_bind = 1;
1657 current_configfile->unloader = unload_configfile;
1660 fs->next = files->next;
1663 current_configfile = fs;
1669 /*********************************************************************
1671 * Function : savearg
1673 * Description : Called from `load_config'. It saves each non-empty
1674 * and non-comment line from config into
1675 * config->proxy_args. This is used to create the
1676 * show-proxy-args page. On error, frees
1677 * config->proxy_args and sets it to NULL
1680 * 1 : command = config setting that was found
1681 * 2 : argument = the setting's argument (if any)
1682 * 3 : config = Configuration to save into.
1686 *********************************************************************/
1687 static void savearg(char *command, char *argument, struct configuration_spec * config)
1696 * Add config option name embedded in
1697 * link to its section in the user-manual
1699 buf = strdup("\n<a href=\"");
1700 if (!strncmpic(config->usermanual, "file://", 7) ||
1701 !strncmpic(config->usermanual, "http", 4))
1703 string_append(&buf, config->usermanual);
1707 string_append(&buf, "http://" CGI_SITE_2_HOST "/user-manual/");
1709 string_append(&buf, CONFIG_HELP_PREFIX);
1710 string_join (&buf, string_toupper(command));
1711 string_append(&buf, "\">");
1712 string_append(&buf, command);
1713 string_append(&buf, "</a> ");
1717 freez(config->proxy_args);
1721 if ( (NULL != argument) && ('\0' != *argument) )
1723 s = html_encode(argument);
1727 freez(config->proxy_args);
1731 if (strncmpic(argument, "http://", 7) == 0)
1733 string_append(&buf, "<a href=\"");
1734 string_append(&buf, s);
1735 string_append(&buf, "\">");
1736 string_join (&buf, s);
1737 string_append(&buf, "</a>");
1741 string_join (&buf, s);
1745 string_append(&buf, "<br>");
1746 string_join(&config->proxy_args, buf);