diff options
author | Greg Stein <gstein@apache.org> | 2000-04-24 14:00:43 +0200 |
---|---|---|
committer | Greg Stein <gstein@apache.org> | 2000-04-24 14:00:43 +0200 |
commit | c2c13c67c3a3665cf7ad1cca06c23b032dedbbce (patch) | |
tree | 4f579f99ba703114e8d0495fc2e41992b6265af2 /include | |
parent | handle error messages during building and processing of the configuration. (diff) | |
download | apache2-c2c13c67c3a3665cf7ad1cca06c23b032dedbbce.tar.xz apache2-c2c13c67c3a3665cf7ad1cca06c23b032dedbbce.zip |
clean up cmd_parms: config_file is no longer valid; end_token is bogus;
add directive.
move configfile_t and functions from httpd.h to http_config.h
new signature for ap_build_config() (since config_file removed from cmd_parms)
add "data" to ap_directive_t for future use by modules. add filename.
syntax checking for section-close directives: a section-open must exist,
the section-close must be </FOO>, and the open/close must match.
the file as a whole must be properly balanced (issue errors for each
unmatched section-open).
</FOO> command_rec structures are obsolete. Remove from http_core.c.
do not store </FOO> directives in the config tree.
clean out section-close logic from http_core.c (and old, related comments)
<Limit> and <LimitExcept> must walk their children.
new mechanism in ap_check_cmd_context() for testing enclosure in a
Directory/Location/File: find_parent()
<IfModule> and <IfDefine> must pass cmd->context when walking the children
several places: we had a walk followed by ap_get_module_config(). that
assumed the walk would create a config that we could fetch, which is not
true -- it is possible that the children are all from other modules
(e.g. the <Files> section in httpd.conf-dist has no "core" directives).
using ap_set_config_vectors() ensures we get a structure, and it returns
it to us.
[ note: when we had </Directory> (and friends) in the tree, the config
would get created; removing the directive removed the config; this
was a bitch to track down :-) ]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85024 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/http_config.h | 37 | ||||
-rw-r--r-- | include/httpd.h | 29 | ||||
-rw-r--r-- | include/util_cfgtree.h | 8 |
3 files changed, 41 insertions, 33 deletions
diff --git a/include/http_config.h b/include/http_config.h index a72f60a666..1be40d8518 100644 --- a/include/http_config.h +++ b/include/http_config.h @@ -155,7 +155,7 @@ typedef struct { int override; /* Which allow-override bits are set */ int limited; /* Which methods are <Limit>ed */ - configfile_t *config_file; /* Config file structure from pcfg_openfile() */ + ap_directive_t *directive; /* the directive specifying this command */ ap_pool_t *pool; /* Pool to allocate new storage in */ ap_pool_t *temp_pool; /* Pool for scratch memory; persists during @@ -173,7 +173,7 @@ typedef struct { * or being called in a dir context (path != NULL). */ const command_rec *cmd; /* configuration command */ - const char *end_token; /* end token required to end a nested section */ + void *context; /* per_dir_config vector passed * to handle_command */ } cmd_parms; @@ -304,8 +304,39 @@ API_EXPORT(void) ap_clear_module_list(void); API_EXPORT(const char *) ap_find_module_name(module *m); API_EXPORT(module *) ap_find_linked_module(const char *name); +/* Common structure for reading of config files / passwd files etc. */ +typedef struct { + int (*getch) (void *param); /* a getc()-like function */ + void *(*getstr) (void *buf, size_t bufsiz, void *param); /* a fgets()-like function */ + int (*close) (void *param); /* a close hander function */ + void *param; /* the argument passed to getch/getstr/close */ + const char *name; /* the filename / description */ + unsigned line_number; /* current line number, starting at 1 */ +} configfile_t; + +/* Open a configfile_t as FILE, return open configfile_t struct pointer */ +API_EXPORT(ap_status_t) ap_pcfg_openfile(configfile_t **, ap_pool_t *p, const char *name); + +/* Allocate a configfile_t handle with user defined functions and params */ +API_EXPORT(configfile_t *) ap_pcfg_open_custom(ap_pool_t *p, const char *descr, + void *param, + int(*getc_func)(void*), + void *(*gets_func) (void *buf, size_t bufsiz, void *param), + int(*close_func)(void *param)); + +/* Read one line from open configfile_t, strip LF, increase line number */ +API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp); + +/* Read one char from open configfile_t, increase line number upon LF */ +API_EXPORT(int) ap_cfg_getc(configfile_t *cfp); + +/* Detach from open configfile_t, calling the close handler */ +API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp); + /* for implementing subconfigs and customized config files */ -API_EXPORT(const char *) ap_build_config(cmd_parms *parms, +API_EXPORT(const char *) ap_build_config(configfile_t *cfp, + ap_pool_t *conf_pool, + ap_pool_t *temp_pool, ap_directive_t **conftree); API_EXPORT(const char *) ap_walk_config(ap_directive_t *conftree, cmd_parms *parms, void *config, int container); diff --git a/include/httpd.h b/include/httpd.h index 1e9b63ed27..1574014098 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -991,35 +991,6 @@ API_EXPORT(int) ap_rind(const char *, char); API_EXPORT(char *) ap_escape_quotes (ap_pool_t *p, const char *instring); -/* Common structure for reading of config files / passwd files etc. */ -typedef struct { - int (*getch) (void *param); /* a getc()-like function */ - void *(*getstr) (void *buf, size_t bufsiz, void *param); /* a fgets()-like function */ - int (*close) (void *param); /* a close hander function */ - void *param; /* the argument passed to getch/getstr/close */ - const char *name; /* the filename / description */ - unsigned line_number; /* current line number, starting at 1 */ -} configfile_t; - -/* Open a configfile_t as FILE, return open configfile_t struct pointer */ -API_EXPORT(ap_status_t) ap_pcfg_openfile(configfile_t **, ap_pool_t *p, const char *name); - -/* Allocate a configfile_t handle with user defined functions and params */ -API_EXPORT(configfile_t *) ap_pcfg_open_custom(ap_pool_t *p, const char *descr, - void *param, - int(*getc_func)(void*), - void *(*gets_func) (void *buf, size_t bufsiz, void *param), - int(*close_func)(void *param)); - -/* Read one line from open configfile_t, strip LF, increase line number */ -API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp); - -/* Read one char from open configfile_t, increase line number upon LF */ -API_EXPORT(int) ap_cfg_getc(configfile_t *cfp); - -/* Detach from open configfile_t, calling the close handler */ -API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp); - /* Misc system hackery */ API_EXPORT(uid_t) ap_uname2id(const char *name); diff --git a/include/util_cfgtree.h b/include/util_cfgtree.h index 6a4a2f6f27..d8e5bc8c7d 100644 --- a/include/util_cfgtree.h +++ b/include/util_cfgtree.h @@ -58,10 +58,16 @@ typedef struct ap_directive_t { const char *directive; const char *args; - int line_num; struct ap_directive_t *next; struct ap_directive_t *first_child; struct ap_directive_t *parent; + + void *data; /* directive's module can store add'l data here */ + + /* ### these may go away in the future, but are needed for now */ + const char *filename; + int line_num; + } ap_directive_t; ap_directive_t *ap_add_node(ap_directive_t **parent, ap_directive_t *current, |