1 const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.53 2006/09/06 18:45:03 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 the SourceForge
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.
38 * Revision 1.53 2006/09/06 18:45:03 fabiankeil
39 * Incorporate modified version of Roland Rosenfeld's patch to
40 * optionally access the user-manual via Privoxy. Closes patch 679075.
42 * Formatting changed to Privoxy style, added call to
43 * cgi_error_no_template if the requested file doesn't
44 * exist and modified check whether or not Privoxy itself
45 * should serve the manual. Should work cross-platform now.
47 * Revision 1.52 2006/09/06 10:43:32 fabiankeil
48 * Added config option enable-remote-http-toggle
49 * to specify if Privoxy should recognize special
50 * headers (currently only X-Filter) to change its
51 * behaviour. Disabled by default.
53 * Revision 1.51 2006/09/06 09:23:37 fabiankeil
54 * Make number of retries in case of forwarded-connect problems
55 * a config file option (forwarded-connect-retries) and use 0 as
58 * Revision 1.50 2006/07/18 14:48:46 david__schmidt
59 * Reorganizing the repository: swapping out what was HEAD (the old 3.1 branch)
60 * with what was really the latest development (the v_3_0_branch branch)
62 * Revision 1.48.2.7 2006/02/02 17:29:16 david__schmidt
63 * Don't forget to malloc space for the null terminator...
65 * Revision 1.48.2.6 2006/01/29 23:10:56 david__schmidt
66 * Multiple filter file support
68 * Revision 1.48.2.5 2003/05/08 15:17:25 oes
69 * Closed two memory leaks; hopefully the last remaining ones
70 * (in the main execution paths, anyway).
72 * Revision 1.48.2.4 2003/04/11 12:06:14 oes
73 * Addressed bug #719435
74 * - Extraneous filterfile directives now logged as errors
75 * - This and unrecnonised directives now really obvious on status page
77 * Revision 1.48.2.3 2003/03/11 11:53:59 oes
78 * Cosmetic: Renamed cryptic variable
80 * Revision 1.48.2.2 2002/11/12 16:28:20 oes
81 * Move unrelated variable declaration out of #ifdef FEATURE_ACL; fixes bug #636655
83 * Revision 1.48.2.1 2002/08/21 17:58:05 oes
84 * Temp kludge to let user and default action file be edited through win32 GUI (FR 592080)
86 * Revision 1.48 2002/05/14 21:30:38 oes
87 * savearg now uses own linking code instead of (now special-cased) add_help_link
89 * Revision 1.47 2002/05/12 21:36:29 jongfoster
90 * Correcting function comments
92 * Revision 1.46 2002/04/26 12:55:14 oes
93 * - New option "user-manual", defaults to our site
94 * via project.h #define
95 * - savearg now embeds option names in help links
97 * Revision 1.45 2002/04/24 02:11:54 oes
98 * Jon's multiple AF patch: Allow up to MAX_AF_FILES actionsfile options
100 * Revision 1.44 2002/04/08 20:37:13 swa
103 * Revision 1.43 2002/04/08 20:36:50 swa
106 * Revision 1.42 2002/04/05 15:50:15 oes
107 * fix for invalid HTML proxy_args
109 * Revision 1.41 2002/03/31 17:19:00 jongfoster
110 * Win32 only: Enabling STRICT to fix a VC++ compile warning.
112 * Revision 1.40 2002/03/26 22:29:55 swa
113 * we have a new homepage!
115 * Revision 1.39 2002/03/24 13:25:43 swa
116 * name change related issues
118 * Revision 1.38 2002/03/24 13:05:48 jongfoster
119 * Renaming re_filterfile to filterfile
121 * Revision 1.37 2002/03/16 23:54:06 jongfoster
122 * Adding graceful termination feature, to help look for memory leaks.
123 * If you enable this (which, by design, has to be done by hand
124 * editing config.h) and then go to http://i.j.b/die, then the program
125 * will exit cleanly after the *next* request. It should free all the
126 * memory that was used.
128 * Revision 1.36 2002/03/13 00:27:05 jongfoster
131 * Revision 1.35 2002/03/07 03:52:44 oes
132 * Set logging to tty for --no-daemon mode
134 * Revision 1.34 2002/03/06 23:14:35 jongfoster
135 * Trivial cosmetic changes to make function comments easier to find.
137 * Revision 1.33 2002/03/05 04:52:42 oes
138 * Deleted non-errlog debugging code
140 * Revision 1.32 2002/03/04 18:24:53 oes
141 * Re-enabled output of unknown config directive hash
143 * Revision 1.31 2002/03/03 15:07:20 oes
144 * Re-enabled automatic config reloading
146 * Revision 1.30 2002/01/22 23:31:43 jongfoster
147 * Replacing strsav() with string_append()
149 * Revision 1.29 2002/01/17 21:02:30 jongfoster
150 * Moving all our URL and URL pattern parsing code to urlmatch.c.
152 * Renaming free_url to free_url_spec, since it frees a struct url_spec.
154 * Revision 1.28 2001/12/30 14:07:32 steudten
155 * - Add signal handling (unix)
156 * - Add SIGHUP handler (unix)
157 * - Add creation of pidfile (unix)
158 * - Add action 'top' in rc file (RH)
159 * - Add entry 'SIGNALS' to manpage
160 * - Add exit message to logfile (unix)
162 * Revision 1.27 2001/11/07 00:02:13 steudten
163 * Add line number in error output for lineparsing for
164 * actionsfile and configfile.
165 * Special handling for CLF added.
167 * Revision 1.26 2001/11/05 21:41:43 steudten
168 * Add changes to be a real daemon just for unix os.
169 * (change cwd to /, detach from controlling tty, set
170 * process group and session leader to the own process.
172 * Add some fatal-error log message for failed malloc().
173 * Add '-d' if compiled with 'configure --with-debug' to
174 * enable debug output.
176 * Revision 1.25 2001/10/25 03:40:48 david__schmidt
177 * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
178 * threads to call select() simultaneously. So, it's time to do a real, live,
179 * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
180 * (native). Both versions will work, but using __OS2__ offers multi-threading.
182 * Revision 1.24 2001/10/23 21:40:30 jongfoster
183 * Added support for enable-edit-actions and enable-remote-toggle config
186 * Revision 1.23 2001/10/07 15:36:00 oes
187 * Introduced new config option "buffer-limit"
189 * Revision 1.22 2001/09/22 16:36:59 jongfoster
190 * Removing unused parameter fs from read_config_line()
192 * Revision 1.21 2001/09/16 17:10:43 jongfoster
193 * Moving function savearg() here, since it was the only thing left in
196 * Revision 1.20 2001/07/30 22:08:36 jongfoster
197 * Tidying up #defines:
198 * - All feature #defines are now of the form FEATURE_xxx
199 * - Permanently turned off WIN_GUI_EDIT
200 * - Permanently turned on WEBDAV and SPLIT_PROXY_ARGS
202 * Revision 1.19 2001/07/15 17:45:16 jongfoster
203 * Removing some unused #includes
205 * Revision 1.18 2001/07/13 14:01:14 oes
206 * - Removed all #ifdef PCRS
207 * - Removed vim-settings
209 * Revision 1.17 2001/06/29 13:31:03 oes
210 * - Improved comments
211 * - Fixed (actionsfile) and sorted hashes
212 * - Introduced admin_address and proxy-info-url
213 * as config parameters
214 * - Renamed config->proxy_args_invocation (which didn't have
215 * the invocation but the options!) to config->proxy_args
216 * - Various adaptions
217 * - Removed logentry from cancelled commit
219 * Revision 1.16 2001/06/09 10:55:28 jongfoster
220 * Changing BUFSIZ ==> BUFFER_SIZE
222 * Revision 1.15 2001/06/07 23:13:40 jongfoster
223 * Merging ACL and forward files into config file.
224 * Cosmetic: Sorting config file options alphabetically.
225 * Cosmetic: Adding brief syntax comments to config file options.
227 * Revision 1.14 2001/06/07 14:46:25 joergs
228 * Missing make_path() added for re_filterfile.
230 * Revision 1.13 2001/06/05 22:33:54 jongfoster
232 * Fixed minor memory leak.
233 * Also now uses make_path to prepend the pathnames.
235 * Revision 1.12 2001/06/05 20:04:09 jongfoster
236 * Now uses _snprintf() in place of snprintf() under Win32.
238 * Revision 1.11 2001/06/04 18:31:58 swa
239 * files are now prefixed with either `confdir' or `logdir'.
240 * `make redhat-dist' replaces both entries confdir and logdir
243 * Revision 1.10 2001/06/03 19:11:54 oes
244 * introduced confdir option
246 * Revision 1.9 2001/06/01 20:06:24 jongfoster
247 * Removed support for "tinygif" option - moved to actions file.
249 * Revision 1.8 2001/05/31 21:27:13 jongfoster
250 * Removed many options from the config file and into the
251 * "actions" file: add_forwarded, suppress_vanilla_wafer,
252 * wafer, add_header, user_agent, referer, from
253 * Also globally replaced "permission" with "action".
255 * Revision 1.7 2001/05/29 09:50:24 jongfoster
256 * Unified blocklist/imagelist/permissionslist.
257 * File format is still under discussion, but the internal changes
260 * Also modified interceptor behaviour:
261 * - We now intercept all URLs beginning with one of the following
262 * prefixes (and *only* these prefixes):
264 * * http://ijbswa.sf.net/config/
265 * * http://ijbswa.sourceforge.net/config/
266 * - New interceptors "home page" - go to http://i.j.b/ to see it.
267 * - Internal changes so that intercepted and fast redirect pages
268 * are not replaced with an image.
269 * - Interceptors now have the option to send a binary page direct
270 * to the client. (i.e. ijb-send-banner uses this)
271 * - Implemented show-url-info interceptor. (Which is why I needed
272 * the above interceptors changes - a typical URL is
273 * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
274 * The previous mechanism would not have intercepted that, and
275 * if it had been intercepted then it then it would have replaced
278 * Revision 1.6 2001/05/26 00:28:36 jongfoster
279 * Automatic reloading of config file.
280 * Removed obsolete SIGHUP support (Unix) and Reload menu option (Win32).
281 * Most of the global variables have been moved to a new
282 * struct configuration_spec, accessed through csp->config->globalname
283 * Most of the globals remaining are used by the Win32 GUI.
285 * Revision 1.5 2001/05/25 22:34:30 jongfoster
288 * Revision 1.4 2001/05/22 18:46:04 oes
290 * - Enabled filtering banners by size rather than URL
291 * by adding patterns that replace all standard banner
292 * sizes with the "Junkbuster" gif to the re_filterfile
294 * - Enabled filtering WebBugs by providing a pattern
295 * which kills all 1x1 images
297 * - Added support for PCRE_UNGREEDY behaviour to pcrs,
298 * which is selected by the (nonstandard and therefore
299 * capital) letter 'U' in the option string.
300 * It causes the quantifiers to be ungreedy by default.
301 * Appending a ? turns back to greedy (!).
303 * - Added a new interceptor ijb-send-banner, which
304 * sends back the "Junkbuster" gif. Without imagelist or
305 * MSIE detection support, or if tinygif = 1, or the
306 * URL isn't recognized as an imageurl, a lame HTML
307 * explanation is sent instead.
309 * - Added new feature, which permits blocking remote
310 * script redirects and firing back a local redirect
312 * The feature is conditionally compiled, i.e. it
313 * can be disabled with --disable-fast-redirects,
314 * plus it must be activated by a "fast-redirects"
315 * line in the config file, has its own log level
316 * and of course wants to be displayed by show-proxy-args
317 * Note: Boy, all the #ifdefs in 1001 locations and
318 * all the fumbling with configure.in and acconfig.h
319 * were *way* more work than the feature itself :-(
321 * - Because a generic redirect template was needed for
322 * this, tinygif = 3 now uses the same.
324 * - Moved GIFs, and other static HTTP response templates
329 * - Removed some >400 CRs again (Jon, you really worked
332 * Revision 1.3 2001/05/20 01:21:20 jongfoster
333 * Version 2.9.4 checkin.
334 * - Merged popupfile and cookiefile, and added control over PCRS
335 * filtering, in new "permissionsfile".
336 * - Implemented LOG_LEVEL_FATAL, so that if there is a configuration
337 * file error you now get a message box (in the Win32 GUI) rather
338 * than the program exiting with no explanation.
339 * - Made killpopup use the PCRS MIME-type checking and HTTP-header
341 * - Removed tabs from "config"
342 * - Moved duplicated url parsing code in "loaders.c" to a new funcition.
343 * - Bumped up version number.
345 * Revision 1.2 2001/05/17 23:01:01 oes
346 * - Cleaned CRLF's from the sources and related files
348 * Revision 1.1.1.1 2001/05/15 13:58:58 oes
349 * Initial import of version 2.9.3 source tree
352 *********************************************************************/
358 #include <sys/types.h>
372 # include <windows.h>
375 # ifndef _WIN_CONSOLE
377 # endif /* ndef _WIN_CONSOLE */
379 /* VC++ has "_snprintf", not "snprintf" */
380 #define snprintf _snprintf
382 #else /* ifndef _WIN32 */
386 # include <sys/wait.h>
388 # include <sys/time.h>
389 # include <sys/stat.h>
399 #include "miscutil.h"
403 #include "urlmatch.h"
406 const char loadcfg_h_rcs[] = LOADCFG_H_VERSION;
409 * Fix a problem with Solaris. There should be no effect on other
411 * Solaris's isspace() is a macro which uses it's argument directly
412 * as an array index. Therefore we need to make sure that high-bit
413 * characters generate +ve values, and ideally we also want to make
414 * the argument match the declared parameter type of "int".
416 #define ijb_isupper(__X) isupper((int)(unsigned char)(__X))
417 #define ijb_tolower(__X) tolower((int)(unsigned char)(__X))
419 #ifdef FEATURE_TOGGLE
420 /* Privoxy is enabled by default. */
421 int global_toggle_state = 1;
422 #endif /* def FEATURE_TOGGLE */
424 /* The filename of the configfile */
425 const char *configfile = NULL;
428 * CGI functions will later need access to the invocation args,
429 * so we will make argc and argv global.
432 const char **Argv = NULL;
434 static struct file_list *current_configfile = NULL;
438 * This takes the "cryptic" hash of each keyword and aliases them to
439 * something a little more readable. This also makes changing the
440 * hash values easier if they should change or the hash algorthm changes.
441 * Use the included "hash" program to find out what the hash will be
442 * for any string supplied on the command line. (Or just put it in the
443 * config file and read the number from the error message in the log).
445 * Please keep this list sorted alphabetically (but with the Windows
446 * console and GUI specific options last).
449 #define hash_actions_file 1196306641ul /* "actionsfile" */
450 #define hash_admin_address 4112573064ul /* "admin-address" */
451 #define hash_buffer_limit 1881726070ul /* "buffer-limit */
452 #define hash_confdir 1978389ul /* "confdir" */
453 #define hash_debug 78263ul /* "debug" */
454 #define hash_deny_access 1227333715ul /* "deny-access" */
455 #define hash_enable_edit_actions 2517097536ul /* "enable-edit-actions" */
456 #define hash_enable_remote_toggle 2979744683ul /* "enable-remote-toggle" */
457 #define hash_enable_remote_http_toggle 110543988ul /* "enable-remote-http-toggle" */
458 #define hash_filterfile 250887266ul /* "filterfile" */
459 #define hash_forward 2029845ul /* "forward" */
460 #define hash_forward_socks4 3963965521ul /* "forward-socks4" */
461 #define hash_forward_socks4a 2639958518ul /* "forward-socks4a" */
462 #define hash_forwarded_connect_retries 101465292ul /* "forwarded-connect-retries" */
463 #define hash_jarfile 2046641ul /* "jarfile" */
464 #define hash_listen_address 1255650842ul /* "listen-address" */
465 #define hash_logdir 422889ul /* "logdir" */
466 #define hash_logfile 2114766ul /* "logfile" */
467 #define hash_permit_access 3587953268ul /* "permit-access" */
468 #define hash_proxy_info_url 3903079059ul /* "proxy-info-url" */
469 #define hash_single_threaded 4250084780ul /* "single-threaded" */
470 #define hash_suppress_blocklists 1948693308ul /* "suppress-blocklists" */
471 #define hash_toggle 447966ul /* "toggle" */
472 #define hash_trust_info_url 430331967ul /* "trust-info-url" */
473 #define hash_trustfile 56494766ul /* "trustfile" */
474 #define hash_usermanual 1416668518ul /* "user-manual" */
475 #define hash_activity_animation 1817904738ul /* "activity-animation" */
476 #define hash_close_button_minimizes 3651284693ul /* "close-button-minimizes" */
477 #define hash_hide_console 2048809870ul /* "hide-console" */
478 #define hash_log_buffer_size 2918070425ul /* "log-buffer-size" */
479 #define hash_log_font_name 2866730124ul /* "log-font-name" */
480 #define hash_log_font_size 2866731014ul /* "log-font-size" */
481 #define hash_log_highlight_messages 4032101240ul /* "log-highlight-messages" */
482 #define hash_log_max_lines 2868344173ul /* "log-max-lines" */
483 #define hash_log_messages 2291744899ul /* "log-messages" */
484 #define hash_show_on_task_bar 215410365ul /* "show-on-task-bar" */
487 static void savearg(char *command, char *argument, struct configuration_spec * config);
489 /*********************************************************************
491 * Function : unload_configfile
493 * Description : Free the config structure and all components.
496 * 1 : data: struct configuration_spec to unload
500 *********************************************************************/
501 void unload_configfile (void * data)
503 struct configuration_spec * config = (struct configuration_spec *)data;
504 struct forward_spec *cur_fwd = config->forward;
508 struct access_control_list *cur_acl = config->acl;
510 while (cur_acl != NULL)
512 struct access_control_list * next_acl = cur_acl->next;
517 #endif /* def FEATURE_ACL */
519 while (cur_fwd != NULL)
521 struct forward_spec * next_fwd = cur_fwd->next;
522 free_url_spec(cur_fwd->url);
524 freez(cur_fwd->gateway_host);
525 freez(cur_fwd->forward_host);
529 config->forward = NULL;
531 #ifdef FEATURE_COOKIE_JAR
532 if ( NULL != config->jar )
534 fclose( config->jar );
537 #endif /* def FEATURE_COOKIE_JAR */
539 freez(config->confdir);
540 freez(config->logdir);
542 freez(config->haddr);
543 freez(config->logfile);
545 for (i = 0; i < MAX_AF_FILES; i++)
547 freez(config->actions_file_short[i]);
548 freez(config->actions_file[i]);
551 freez(config->admin_address);
552 freez(config->proxy_info_url);
553 freez(config->proxy_args);
554 freez(config->usermanual);
556 #ifdef FEATURE_COOKIE_JAR
557 freez(config->jarfile);
558 #endif /* def FEATURE_COOKIE_JAR */
561 freez(config->trustfile);
562 list_remove_all(config->trust_info);
563 #endif /* def FEATURE_TRUST */
565 for (i = 0; i < MAX_AF_FILES; i++)
567 freez(config->re_filterfile[i]);
574 #ifdef FEATURE_GRACEFUL_TERMINATION
575 /*********************************************************************
577 * Function : unload_current_config_file
579 * Description : Unloads current config file - reset to state at
580 * beginning of program.
586 *********************************************************************/
587 void unload_current_config_file(void)
589 if (current_configfile)
591 current_configfile->unloader = unload_configfile;
592 current_configfile = NULL;
598 /*********************************************************************
600 * Function : load_config
602 * Description : Load the config file and all parameters.
606 * Returns : The configuration_spec, or NULL on error.
608 *********************************************************************/
609 struct configuration_spec * load_config(void)
611 char buf[BUFFER_SIZE];
613 FILE *configfp = NULL;
614 struct configuration_spec * config = NULL;
615 struct client_state * fake_csp;
616 struct file_list *fs;
617 unsigned long linenum = 0;
620 if ( !check_file_changed(current_configfile, configfile, &fs))
622 /* No need to load */
623 return ((struct configuration_spec *)current_configfile->f);
627 log_error(LOG_LEVEL_FATAL, "can't check configuration file '%s': %E",
631 log_error(LOG_LEVEL_INFO, "loading configuration file '%s':", configfile);
633 #ifdef FEATURE_TOGGLE
634 global_toggle_state = 1;
635 #endif /* def FEATURE_TOGGLE */
637 fs->f = config = (struct configuration_spec *)zalloc(sizeof(*config));
643 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
644 /* Never get here - LOG_LEVEL_FATAL causes program exit */
648 * This is backwards from how it's usually done.
649 * Following the usual pattern, "fs" would be stored in a member
650 * variable in "csp", and then we'd access "config" from "fs->f",
651 * using a cast. However, "config" is used so often that a
652 * cast each time would be very ugly, and the extra indirection
653 * would waste CPU cycles. Therefore we store "config" in
654 * "csp->config", and "fs" in "csp->config->config_file_list".
656 config->config_file_list = fs;
661 config->multi_threaded = 1;
662 config->hport = HADDR_PORT;
663 config->buffer_limit = 4096 * 1024;
664 config->usermanual = strdup(USER_MANUAL_URL);
665 config->proxy_args = strdup("");
666 config->forwarded_connect_retries = 0;
667 config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE;
669 if ((configfp = fopen(configfile, "r")) == NULL)
671 log_error(LOG_LEVEL_FATAL, "can't open configuration file '%s': %E",
673 /* Never get here - LOG_LEVEL_FATAL causes program exit */
676 while (read_config_line(buf, sizeof(buf), configfp, &linenum) != NULL)
678 char cmd[BUFFER_SIZE];
679 char arg[BUFFER_SIZE];
680 char tmp[BUFFER_SIZE];
682 struct access_control_list *cur_acl;
683 #endif /* def FEATURE_ACL */
684 struct forward_spec *cur_fwd;
690 /* Copy command (i.e. up to space or tab) into cmd */
693 while (*p && (*p != ' ') && (*p != '\t'))
699 /* Skip over the whitespace in buf */
700 while (*p && ((*p == ' ') || (*p == '\t')))
705 /* Copy the argument into arg */
708 /* Should never happen, but check this anyway */
714 /* Make sure the command field is lower case */
719 *p = ijb_tolower(*p);
723 /* Save the argument for show-proxy-args */
724 savearg(cmd, arg, config);
727 switch( hash_string( cmd ) )
729 /* *************************************************************************
730 * actionsfile actions-file-name
731 * In confdir by default
732 * *************************************************************************/
733 case hash_actions_file :
735 while ((i < MAX_AF_FILES) && (NULL != config->actions_file[i]))
740 if (i >= MAX_AF_FILES)
742 log_error(LOG_LEVEL_FATAL, "Too many 'actionsfile' directives in config file - limit is %d.\n"
743 "(You can increase this limit by changing MAX_AF_FILES in project.h and recompiling).",
746 config->actions_file_short[i] = strdup(arg);
747 p = malloc(strlen(arg) + sizeof(".action"));
750 log_error(LOG_LEVEL_FATAL, "Out of memory");
753 strcat(p, ".action");
754 config->actions_file[i] = make_path(config->confdir, p);
758 /* *************************************************************************
759 * admin-address email-address
760 * *************************************************************************/
761 case hash_admin_address :
762 freez(config->admin_address);
763 config->admin_address = strdup(arg);
766 /* *************************************************************************
768 * *************************************************************************/
769 case hash_buffer_limit :
770 config->buffer_limit = (size_t) 1024 * atoi(arg);
773 /* *************************************************************************
774 * confdir directory-name
775 * *************************************************************************/
777 freez(config->confdir);
778 config->confdir = make_path( NULL, arg);
781 /* *************************************************************************
783 * Specifies debug level, multiple values are ORed together.
784 * *************************************************************************/
786 config->debug |= atoi(arg);
789 /* *************************************************************************
790 * deny-access source-ip[/significant-bits] [dest-ip[/significant-bits]]
791 * *************************************************************************/
793 case hash_deny_access:
794 vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
796 if ((vec_count != 1) && (vec_count != 2))
798 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
799 "deny-access directive in configuration file.");
800 string_append(&config->proxy_args,
801 "<br>\nWARNING: Wrong number of parameters for "
802 "deny-access directive in configuration file.<br><br>\n");
806 /* allocate a new node */
807 cur_acl = (struct access_control_list *) zalloc(sizeof(*cur_acl));
811 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
812 /* Never get here - LOG_LEVEL_FATAL causes program exit */
815 cur_acl->action = ACL_DENY;
817 if (acl_addr(vec[0], cur_acl->src) < 0)
819 log_error(LOG_LEVEL_ERROR, "Invalid source IP for deny-access "
820 "directive in configuration file: \"%s\"", vec[0]);
821 string_append(&config->proxy_args,
822 "<br>\nWARNING: Invalid source IP for deny-access directive"
823 " in configuration file: \"");
824 string_append(&config->proxy_args,
826 string_append(&config->proxy_args,
833 if (acl_addr(vec[1], cur_acl->dst) < 0)
835 log_error(LOG_LEVEL_ERROR, "Invalid destination IP for deny-access "
836 "directive in configuration file: \"%s\"", vec[0]);
837 string_append(&config->proxy_args,
838 "<br>\nWARNING: Invalid destination IP for deny-access directive"
839 " in configuration file: \"");
840 string_append(&config->proxy_args,
842 string_append(&config->proxy_args,
850 * Add it to the list. Note we reverse the list to get the
851 * behaviour the user expects. With both the ACL and
852 * actions file, the last match wins. However, the internal
853 * implementations are different: The actions file is stored
854 * in the same order as the file, and scanned completely.
855 * With the ACL, we reverse the order as we load it, then
856 * when we scan it we stop as soon as we get a match.
858 cur_acl->next = config->acl;
859 config->acl = cur_acl;
862 #endif /* def FEATURE_ACL */
864 /* *************************************************************************
865 * enable-edit-actions 0|1
866 * *************************************************************************/
867 #ifdef FEATURE_CGI_EDIT_ACTIONS
868 case hash_enable_edit_actions:
869 if ((*arg != '\0') && (0 != atoi(arg)))
871 config->feature_flags |= RUNTIME_FEATURE_CGI_EDIT_ACTIONS;
875 config->feature_flags &= ~RUNTIME_FEATURE_CGI_EDIT_ACTIONS;
878 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
880 /* *************************************************************************
881 * enable-remote-toggle 0|1
882 * *************************************************************************/
883 #ifdef FEATURE_CGI_EDIT_ACTIONS
884 case hash_enable_remote_toggle:
885 if ((*arg != '\0') && (0 != atoi(arg)))
887 config->feature_flags |= RUNTIME_FEATURE_CGI_TOGGLE;
891 config->feature_flags &= ~RUNTIME_FEATURE_CGI_TOGGLE;
894 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
896 /* *************************************************************************
897 * enable-remote-http-toggle 0|1
898 * *************************************************************************/
899 case hash_enable_remote_http_toggle:
900 if ((*arg != '\0') && (0 != atoi(arg)))
902 config->feature_flags |= RUNTIME_FEATURE_HTTP_TOGGLE;
906 config->feature_flags &= ~RUNTIME_FEATURE_HTTP_TOGGLE;
910 /* *************************************************************************
911 * filterfile file-name
912 * In confdir by default.
913 * *************************************************************************/
914 case hash_filterfile :
916 while ((i < MAX_AF_FILES) && (NULL != config->re_filterfile[i]))
921 if (i >= MAX_AF_FILES)
923 log_error(LOG_LEVEL_FATAL, "Too many 'filterfile' directives in config file - limit is %d.\n"
924 "(You can increase this limit by changing MAX_AF_FILES in project.h and recompiling).",
927 config->re_filterfile_short[i] = strdup(arg);
928 p = malloc(strlen(arg) + 1);
931 log_error(LOG_LEVEL_FATAL, "Out of memory");
934 config->re_filterfile[i] = make_path(config->confdir, p);
938 /* *************************************************************************
939 * forward url-pattern (.|http-proxy-host[:port])
940 * *************************************************************************/
942 vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
946 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for forward "
947 "directive in configuration file.");
948 string_append(&config->proxy_args,
949 "<br>\nWARNING: Wrong number of parameters for "
950 "forward directive in configuration file.");
954 /* allocate a new node */
955 cur_fwd = zalloc(sizeof(*cur_fwd));
958 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
959 /* Never get here - LOG_LEVEL_FATAL causes program exit */
963 cur_fwd->type = SOCKS_NONE;
965 /* Save the URL pattern */
966 if (create_url_spec(cur_fwd->url, vec[0]))
968 log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward "
969 "directive in configuration file.");
970 string_append(&config->proxy_args,
971 "<br>\nWARNING: Bad URL specifier for "
972 "forward directive in configuration file.");
976 /* Parse the parent HTTP proxy host:port */
979 if (strcmp(p, ".") != 0)
981 cur_fwd->forward_host = strdup(p);
983 if (NULL != (p = strchr(cur_fwd->forward_host, ':')))
986 cur_fwd->forward_port = atoi(p);
989 if (cur_fwd->forward_port <= 0)
991 cur_fwd->forward_port = 8000;
996 cur_fwd->next = config->forward;
997 config->forward = cur_fwd;
1001 /* *************************************************************************
1002 * forward-socks4 url-pattern socks-proxy[:port] (.|http-proxy[:port])
1003 * *************************************************************************/
1004 case hash_forward_socks4:
1005 vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
1009 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
1010 "forward-socks4 directive in configuration file.");
1011 string_append(&config->proxy_args,
1012 "<br>\nWARNING: Wrong number of parameters for "
1013 "forward-socks4 directive in configuration file.");
1017 /* allocate a new node */
1018 cur_fwd = zalloc(sizeof(*cur_fwd));
1019 if (cur_fwd == NULL)
1021 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
1022 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1026 cur_fwd->type = SOCKS_4;
1028 /* Save the URL pattern */
1029 if (create_url_spec(cur_fwd->url, vec[0]))
1031 log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward-socks4 "
1032 "directive in configuration file.");
1033 string_append(&config->proxy_args,
1034 "<br>\nWARNING: Bad URL specifier for "
1035 "forward-socks4 directive in configuration file.");
1039 /* Parse the SOCKS proxy host[:port] */
1042 if (strcmp(p, ".") != 0)
1044 cur_fwd->gateway_host = strdup(p);
1046 if (NULL != (p = strchr(cur_fwd->gateway_host, ':')))
1049 cur_fwd->gateway_port = atoi(p);
1051 if (cur_fwd->gateway_port <= 0)
1053 cur_fwd->gateway_port = 1080;
1057 /* Parse the parent HTTP proxy host[:port] */
1060 if (strcmp(p, ".") != 0)
1062 cur_fwd->forward_host = strdup(p);
1064 if (NULL != (p = strchr(cur_fwd->forward_host, ':')))
1067 cur_fwd->forward_port = atoi(p);
1070 if (cur_fwd->forward_port <= 0)
1072 cur_fwd->forward_port = 8000;
1077 cur_fwd->next = config->forward;
1078 config->forward = cur_fwd;
1082 /* *************************************************************************
1083 * forward-socks4a url-pattern socks-proxy[:port] (.|http-proxy[:port])
1084 * *************************************************************************/
1085 case hash_forward_socks4a:
1086 vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
1090 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
1091 "forward-socks4a directive in configuration file.");
1092 string_append(&config->proxy_args,
1093 "<br>\nWARNING: Wrong number of parameters for "
1094 "forward-socks4a directive in configuration file.");
1098 /* allocate a new node */
1099 cur_fwd = zalloc(sizeof(*cur_fwd));
1100 if (cur_fwd == NULL)
1102 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
1103 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1107 cur_fwd->type = SOCKS_4A;
1109 /* Save the URL pattern */
1110 if (create_url_spec(cur_fwd->url, vec[0]))
1112 log_error(LOG_LEVEL_ERROR, "Bad URL specifier for forward-socks4a "
1113 "directive in configuration file.");
1114 string_append(&config->proxy_args,
1115 "<br>\nWARNING: Bad URL specifier for "
1116 "forward-socks4a directive in configuration file.");
1120 /* Parse the SOCKS proxy host[:port] */
1123 cur_fwd->gateway_host = strdup(p);
1125 if (NULL != (p = strchr(cur_fwd->gateway_host, ':')))
1128 cur_fwd->gateway_port = atoi(p);
1130 if (cur_fwd->gateway_port <= 0)
1132 cur_fwd->gateway_port = 1080;
1135 /* Parse the parent HTTP proxy host[:port] */
1138 if (strcmp(p, ".") != 0)
1140 cur_fwd->forward_host = strdup(p);
1142 if (NULL != (p = strchr(cur_fwd->forward_host, ':')))
1145 cur_fwd->forward_port = atoi(p);
1148 if (cur_fwd->forward_port <= 0)
1150 cur_fwd->forward_port = 8000;
1155 cur_fwd->next = config->forward;
1156 config->forward = cur_fwd;
1160 /* *************************************************************************
1161 * forwarded-connect-retries n
1162 * *************************************************************************/
1163 case hash_forwarded_connect_retries :
1164 config->forwarded_connect_retries = atoi(arg);
1167 /* *************************************************************************
1168 * jarfile jar-file-name
1169 * In logdir by default
1170 * *************************************************************************/
1171 #ifdef FEATURE_COOKIE_JAR
1173 freez(config->jarfile);
1174 config->jarfile = make_path(config->logdir, arg);
1176 #endif /* def FEATURE_COOKIE_JAR */
1178 /* *************************************************************************
1179 * listen-address [ip][:port]
1180 * *************************************************************************/
1181 case hash_listen_address :
1182 freez(config->haddr);
1183 config->haddr = strdup(arg);
1186 /* *************************************************************************
1187 * logdir directory-name
1188 * *************************************************************************/
1190 freez(config->logdir);
1191 config->logdir = make_path(NULL, arg);
1194 /* *************************************************************************
1195 * logfile log-file-name
1196 * In logdir by default
1197 * *************************************************************************/
1199 freez(config->logfile);
1200 config->logfile = no_daemon ? NULL : make_path(config->logdir, arg);
1203 /* *************************************************************************
1204 * permit-access source-ip[/significant-bits] [dest-ip[/significant-bits]]
1205 * *************************************************************************/
1207 case hash_permit_access:
1208 vec_count = ssplit(arg, " \t", vec, SZ(vec), 1, 1);
1210 if ((vec_count != 1) && (vec_count != 2))
1212 log_error(LOG_LEVEL_ERROR, "Wrong number of parameters for "
1213 "permit-access directive in configuration file.");
1214 string_append(&config->proxy_args,
1215 "<br>\nWARNING: Wrong number of parameters for "
1216 "permit-access directive in configuration file.<br><br>\n");
1221 /* allocate a new node */
1222 cur_acl = (struct access_control_list *) zalloc(sizeof(*cur_acl));
1224 if (cur_acl == NULL)
1226 log_error(LOG_LEVEL_FATAL, "can't allocate memory for configuration");
1227 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1230 cur_acl->action = ACL_PERMIT;
1232 if (acl_addr(vec[0], cur_acl->src) < 0)
1234 log_error(LOG_LEVEL_ERROR, "Invalid source IP for permit-access "
1235 "directive in configuration file: \"%s\"", vec[0]);
1236 string_append(&config->proxy_args,
1237 "<br>\nWARNING: Invalid source IP for permit-access directive"
1238 " in configuration file: \"");
1239 string_append(&config->proxy_args,
1241 string_append(&config->proxy_args,
1248 if (acl_addr(vec[1], cur_acl->dst) < 0)
1250 log_error(LOG_LEVEL_ERROR, "Invalid destination IP for "
1251 "permit-access directive in configuration file: \"%s\"",
1253 string_append(&config->proxy_args,
1254 "<br>\nWARNING: Invalid destination IP for permit-access directive"
1255 " in configuration file: \"");
1256 string_append(&config->proxy_args,
1258 string_append(&config->proxy_args,
1266 * Add it to the list. Note we reverse the list to get the
1267 * behaviour the user expects. With both the ACL and
1268 * actions file, the last match wins. However, the internal
1269 * implementations are different: The actions file is stored
1270 * in the same order as the file, and scanned completely.
1271 * With the ACL, we reverse the order as we load it, then
1272 * when we scan it we stop as soon as we get a match.
1274 cur_acl->next = config->acl;
1275 config->acl = cur_acl;
1278 #endif /* def FEATURE_ACL */
1280 /* *************************************************************************
1281 * proxy-info-url url
1282 * *************************************************************************/
1283 case hash_proxy_info_url :
1284 freez(config->proxy_info_url);
1285 config->proxy_info_url = strdup(arg);
1288 /* *************************************************************************
1290 * *************************************************************************/
1291 case hash_single_threaded :
1292 config->multi_threaded = 0;
1295 /* *************************************************************************
1297 * *************************************************************************/
1298 #ifdef FEATURE_TOGGLE
1300 global_toggle_state = atoi(arg);
1302 #endif /* def FEATURE_TOGGLE */
1304 /* *************************************************************************
1305 * trust-info-url url
1306 * *************************************************************************/
1307 #ifdef FEATURE_TRUST
1308 case hash_trust_info_url :
1309 enlist(config->trust_info, arg);
1311 #endif /* def FEATURE_TRUST */
1313 /* *************************************************************************
1314 * trustfile filename
1315 * (In confdir by default.)
1316 * *************************************************************************/
1317 #ifdef FEATURE_TRUST
1318 case hash_trustfile :
1319 freez(config->trustfile);
1320 config->trustfile = make_path(config->confdir, arg);
1322 #endif /* def FEATURE_TRUST */
1324 /* *************************************************************************
1326 * *************************************************************************/
1327 case hash_usermanual :
1328 freez(config->usermanual);
1329 config->usermanual = strdup(arg);
1332 /* *************************************************************************
1333 * Win32 Console options:
1334 * *************************************************************************/
1336 /* *************************************************************************
1338 * *************************************************************************/
1340 case hash_hide_console :
1343 #endif /*def _WIN_CONSOLE*/
1346 /* *************************************************************************
1347 * Win32 GUI options:
1348 * *************************************************************************/
1350 #if defined(_WIN32) && ! defined(_WIN_CONSOLE)
1351 /* *************************************************************************
1352 * activity-animation (0|1)
1353 * *************************************************************************/
1354 case hash_activity_animation :
1355 g_bShowActivityAnimation = atoi(arg);
1358 /* *************************************************************************
1359 * close-button-minimizes (0|1)
1360 * *************************************************************************/
1361 case hash_close_button_minimizes :
1362 g_bCloseHidesWindow = atoi(arg);
1365 /* *************************************************************************
1366 * log-buffer-size (0|1)
1367 * *************************************************************************/
1368 case hash_log_buffer_size :
1369 g_bLimitBufferSize = atoi(arg);
1372 /* *************************************************************************
1373 * log-font-name fontnane
1374 * *************************************************************************/
1375 case hash_log_font_name :
1376 strcpy( g_szFontFaceName, arg );
1379 /* *************************************************************************
1381 * *************************************************************************/
1382 case hash_log_font_size :
1383 g_nFontSize = atoi(arg);
1386 /* *************************************************************************
1387 * log-highlight-messages (0|1)
1388 * *************************************************************************/
1389 case hash_log_highlight_messages :
1390 g_bHighlightMessages = atoi(arg);
1393 /* *************************************************************************
1395 * *************************************************************************/
1396 case hash_log_max_lines :
1397 g_nMaxBufferLines = atoi(arg);
1400 /* *************************************************************************
1401 * log-messages (0|1)
1402 * *************************************************************************/
1403 case hash_log_messages :
1404 g_bLogMessages = atoi(arg);
1407 /* *************************************************************************
1408 * show-on-task-bar (0|1)
1409 * *************************************************************************/
1410 case hash_show_on_task_bar :
1411 g_bShowOnTaskBar = atoi(arg);
1414 #endif /* defined(_WIN32) && ! defined(_WIN_CONSOLE) */
1417 /* *************************************************************************
1418 * Warnings about unsupported features
1419 * *************************************************************************/
1421 case hash_deny_access:
1422 #endif /* ndef FEATURE_ACL */
1423 #ifndef FEATURE_CGI_EDIT_ACTIONS
1424 case hash_enable_edit_actions:
1425 case hash_enable_remote_toggle:
1426 #endif /* def FEATURE_CGI_EDIT_ACTIONS */
1427 #ifndef FEATURE_COOKIE_JAR
1429 #endif /* ndef FEATURE_COOKIE_JAR */
1431 case hash_permit_access:
1432 #endif /* ndef FEATURE_ACL */
1433 #ifndef FEATURE_TOGGLE
1435 #endif /* ndef FEATURE_TOGGLE */
1436 #ifndef FEATURE_TRUST
1437 case hash_trustfile :
1438 case hash_trust_info_url :
1439 #endif /* ndef FEATURE_TRUST */
1441 #ifndef _WIN_CONSOLE
1442 case hash_hide_console :
1443 #endif /* ndef _WIN_CONSOLE */
1445 #if defined(_WIN_CONSOLE) || ! defined(_WIN32)
1446 case hash_activity_animation :
1447 case hash_close_button_minimizes :
1448 case hash_log_buffer_size :
1449 case hash_log_font_name :
1450 case hash_log_font_size :
1451 case hash_log_highlight_messages :
1452 case hash_log_max_lines :
1453 case hash_log_messages :
1454 case hash_show_on_task_bar :
1455 #endif /* defined(_WIN_CONSOLE) || ! defined(_WIN32) */
1456 /* These warnings are annoying - so hide them. -- Jon */
1457 /* log_error(LOG_LEVEL_INFO, "Unsupported directive \"%s\" ignored.", cmd); */
1460 /* *************************************************************************/
1462 /* *************************************************************************/
1464 * I decided that I liked this better as a warning than an
1465 * error. To change back to an error, just change log level
1466 * to LOG_LEVEL_FATAL.
1468 log_error(LOG_LEVEL_ERROR, "Ignoring unrecognized directive '%s' (%luul) in line %lu "
1469 "in configuration file (%s).", buf, hash_string(cmd), linenum, configfile);
1470 string_append(&config->proxy_args,
1471 " <b><font color=\"red\">WARNING: unrecognized directive, ignored</font></b>");
1474 /* *************************************************************************/
1475 } /* end switch( hash_string(cmd) ) */
1476 } /* end while ( read_config_line(...) ) */
1480 if (NULL == config->proxy_args)
1482 log_error(LOG_LEVEL_FATAL, "Out of memory loading config - insufficient memory for config->proxy_args");
1485 init_error_log(Argv[0], config->logfile, config->debug);
1487 if (config->actions_file[0])
1489 add_loader(load_actions_file, config);
1492 if (config->re_filterfile)
1494 add_loader(load_re_filterfile, config);
1497 #ifdef FEATURE_TRUST
1498 if (config->trustfile)
1500 add_loader(load_trustfile, config);
1502 #endif /* def FEATURE_TRUST */
1504 #ifdef FEATURE_COOKIE_JAR
1505 if ( NULL != config->jarfile )
1507 if ( NULL == (config->jar = fopen(config->jarfile, "a")) )
1509 log_error(LOG_LEVEL_FATAL, "can't open jarfile '%s': %E", config->jarfile);
1510 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1512 setbuf(config->jar, NULL);
1514 #endif /* def FEATURE_COOKIE_JAR */
1516 if ( NULL == config->haddr )
1518 config->haddr = strdup( HADDR_DEFAULT );
1521 if ( NULL != config->haddr )
1523 if (NULL != (p = strchr(config->haddr, ':')))
1528 config->hport = atoi(p);
1532 if (config->hport <= 0)
1535 log_error(LOG_LEVEL_FATAL, "invalid bind port spec %s", config->haddr);
1536 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1538 if (*config->haddr == '\0')
1540 config->haddr = NULL;
1545 * Want to run all the loaders once now.
1547 * Need to set up a fake csp, so they can get to the config.
1549 fake_csp = (struct client_state *) zalloc (sizeof(*fake_csp));
1550 fake_csp->config = config;
1552 if (run_loader(fake_csp))
1555 log_error(LOG_LEVEL_FATAL, "A loader failed while loading config file. Exiting.");
1556 /* Never get here - LOG_LEVEL_FATAL causes program exit */
1560 /* FIXME: this is a kludge for win32 */
1561 #if defined(_WIN32) && !defined (_WIN_CONSOLE)
1563 g_default_actions_file = config->actions_file[1]; /* FIXME Hope this is default.action */
1564 g_user_actions_file = config->actions_file[2]; /* FIXME Hope this is user.action */
1565 g_re_filterfile = config->re_filterfile[0]; /* FIXME Hope this is default.filter */
1567 #ifdef FEATURE_TRUST
1568 g_trustfile = config->trustfile;
1569 #endif /* def FEATURE_TRUST */
1572 #endif /* defined(_WIN32) && !defined (_WIN_CONSOLE) */
1573 /* FIXME: end kludge */
1576 config->need_bind = 1;
1578 if (current_configfile)
1580 struct configuration_spec * oldcfg = (struct configuration_spec *)
1581 current_configfile->f;
1583 * Check if config->haddr,hport == oldcfg->haddr,hport
1585 * The following could be written more compactly as a single,
1586 * (unreadably long) if statement.
1588 config->need_bind = 0;
1589 if (config->hport != oldcfg->hport)
1591 config->need_bind = 1;
1593 else if (config->haddr == NULL)
1595 if (oldcfg->haddr != NULL)
1597 config->need_bind = 1;
1600 else if (oldcfg->haddr == NULL)
1602 config->need_bind = 1;
1604 else if (0 != strcmp(config->haddr, oldcfg->haddr))
1606 config->need_bind = 1;
1609 current_configfile->unloader = unload_configfile;
1612 fs->next = files->next;
1615 current_configfile = fs;
1621 /*********************************************************************
1623 * Function : savearg
1625 * Description : Called from `load_config'. It saves each non-empty
1626 * and non-comment line from config into
1627 * config->proxy_args. This is used to create the
1628 * show-proxy-args page. On error, frees
1629 * config->proxy_args and sets it to NULL
1632 * 1 : command = config setting that was found
1633 * 2 : argument = the setting's argument (if any)
1634 * 3 : config = Configuration to save into.
1638 *********************************************************************/
1639 static void savearg(char *command, char *argument, struct configuration_spec * config)
1649 * Add config option name embedded in
1650 * link to it's section in the user-manual
1652 buf = strdup("\n<br><a href=\"");
1653 if (!strncmpic(config->usermanual, "file://", 7) ||
1654 !strncmpic(config->usermanual, "http", 4))
1656 string_append(&buf, config->usermanual);
1660 string_append(&buf, "http://");
1661 string_append(&buf, CGI_SITE_2_HOST);
1662 string_append(&buf, "/user-manual/");
1664 string_append(&buf, CONFIG_HELP_PREFIX);
1665 string_join (&buf, string_toupper(command));
1666 string_append(&buf, "\">");
1667 string_append(&buf, command);
1668 string_append(&buf, "</a> ");
1672 freez(config->proxy_args);
1676 if ( (NULL != argument) && ('\0' != *argument) )
1678 s = html_encode(argument);
1682 freez(config->proxy_args);
1686 if (strncmpic(argument, "http://", 7) == 0)
1688 string_append(&buf, "<a href=\"");
1689 string_append(&buf, s);
1690 string_append(&buf, "\">");
1691 string_join (&buf, s);
1692 string_append(&buf, "</a>");
1696 string_join (&buf, s);
1700 string_join(&config->proxy_args, buf);