diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-03-13 21:32:33 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-03-13 21:32:33 +0000 |
commit | badd237fe61461c8f3b27bd50fcff4cfd2c62b57 (patch) | |
tree | 3352992682d88fdf29fd8a5b9c7bb3337826bf45 /src | |
parent | b06f26cba16884de23f33230f37e32231d029488 (diff) | |
download | tinyproxy-badd237fe61461c8f3b27bd50fcff4cfd2c62b57.tar.gz tinyproxy-badd237fe61461c8f3b27bd50fcff4cfd2c62b57.zip |
# Added variables to config structure to keep track of the files to be
displayed for various HTTP errors and the stats page. [Steven Young]
Diffstat (limited to 'src')
-rw-r--r-- | src/tinyproxy.c | 20 | ||||
-rw-r--r-- | src/tinyproxy.h | 27 |
2 files changed, 37 insertions, 10 deletions
diff --git a/src/tinyproxy.c b/src/tinyproxy.c index 6239452..a702e35 100644 --- a/src/tinyproxy.c +++ b/src/tinyproxy.c @@ -1,4 +1,4 @@ -/* $Id: tinyproxy.c,v 1.44 2003-02-26 22:37:38 rjkaes Exp $ +/* $Id: tinyproxy.c,v 1.45 2003-03-13 21:32:33 rjkaes Exp $ * * The initialize routine. Basically sets up all the initial stuff (logfile, * listening socket, config options, etc.) and then sits there and loops @@ -152,7 +152,6 @@ main(int argc, char **argv) unsigned int godaemon = TRUE; /* boolean */ struct passwd *thisuser = NULL; struct group *thisgroup = NULL; - char *conf_file = DEFAULT_CONF_FILE; /* * Disable the creation of CORE files right up front. @@ -168,6 +167,9 @@ main(int argc, char **argv) log_message(LOG_INFO, "Initializing " PACKAGE " ..."); + /* Default configuration file location */ + config.config_file = DEFAULT_CONF_FILE; + /* * Process the various options */ @@ -183,8 +185,8 @@ main(int argc, char **argv) godaemon = FALSE; break; case 'c': - conf_file = safestrdup(optarg); - if (!conf_file) { + config.config_file = safestrdup(optarg); + if (!config.config_file) { fprintf(stderr, "%s: Could not allocate memory.\n", argv[0]); @@ -199,13 +201,19 @@ main(int argc, char **argv) } /* + * Make sure the HTML error pages array is NULL to begin with. + * (FIXME: Should have a better API for all this) + */ + config.errorpages = NULL; + + /* * Read in the settings from the config file. */ - yyin = fopen(conf_file, "r"); + yyin = fopen(config.config_file, "r"); if (!yyin) { fprintf(stderr, "%s: Could not open configuration file \"%s\".\n", - argv[0], conf_file); + argv[0], config.config_file); exit(EX_SOFTWARE); } yyparse(); diff --git a/src/tinyproxy.h b/src/tinyproxy.h index a12948a..e5c9e1c 100644 --- a/src/tinyproxy.h +++ b/src/tinyproxy.h @@ -1,4 +1,4 @@ -/* $Id: tinyproxy.h,v 1.37 2003-01-27 17:57:37 rjkaes Exp $ +/* $Id: tinyproxy.h,v 1.38 2003-03-13 21:32:33 rjkaes Exp $ * * See 'tinyproxy.c' for a detailed description. * @@ -27,6 +27,7 @@ struct config_s { char *logf_name; + char *config_file; unsigned int syslog; /* boolean */ int port; char *stathost; @@ -51,10 +52,28 @@ struct config_s { unsigned int idletimeout; char* bind_address; - char* dnsserver_location; - char* dnsserver_socket; - unsigned int via_http_header; /* boolean */ + + /* + * Error page support. This is an array of pointers to structures + * which describe the error page path, and what HTTP error it handles. + * an example would be { "/usr/local/etc/tinyproxy/404.html", 404 } + * Ending of array is noted with NULL, 0. + */ + struct error_pages_s { + char *errorpage_path; + unsigned int errorpage_errnum; + } **errorpages; + /* + * Error page to be displayed if appropriate page cannot be located + * in the errorpages structure. + */ + char *errorpage_undef; + + /* + * The HTML statistics page. + */ + char *statpage; }; /* Global Structures used in the program */ |