NULL, \
MODULE_MAGIC_COOKIE
-#if AP_RBB_HACK
+
+/* CONFIGURATION VECTOR FUNCTIONS */
+
+typedef struct ap_conf_vector_t ap_conf_vector_t;
+
+#ifdef AP_DEBUG
/**
* Generic accessors for other modules to get at their own module-specific
* data
* usually r->per_dir_config or s->module_config
* @param m The module to get the data for.
* @return The module-specific data
- * @deffunc void *ap_get_module_config(void *conf_vector, module *m)
+ * @deffunc void *ap_get_module_config(const ap_conf_vector_t *cv, module *m)
*/
-AP_DECLARE(void *) ap_get_module_config(void *conf_vector, module *m);
-#endif
-#if AP_RBB_HACK
+AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
+ const module *m);
+
/**
* Generic accessors for other modules to set at their own module-specific
* data
* usually r->per_dir_config or s->module_config
* @param m The module to set the data for.
* @param val The module-specific data to set
- * @deffunc void ap_set_module_config(void *conf_vector, module *m, void *val)
+ * @deffunc void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val)
*/
-AP_DECLARE(void) ap_set_module_config(void *conf_vector, module *m, void *val);
-#endif
+AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
+ void *val);
+
+#else /* AP_DEBUG */
#define ap_get_module_config(v,m) \
(((void **)(v))[(m)->module_index])
#define ap_set_module_config(v,m,val) \
((((void **)(v))[(m)->module_index]) = (val))
+#endif /* AP_DEBUG */
+
+
/**
* Generic command handling function for strings
* @param cmd The command parameters for this directive
* @param p The pool to allocate the config vector out of
* @return The config vector
*/
-void *ap_create_request_config(apr_pool_t *p);
+ap_conf_vector_t *ap_create_request_config(apr_pool_t *p);
/**
* Setup the config vector for per dir module configs
* @return The config vector
* @deffunc void *ap_create_per_dir_config(apr_pool_t *p)
*/
-AP_CORE_DECLARE(void *) ap_create_per_dir_config(apr_pool_t *p);
+AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p);
/**
* Run all of the modules merge per dir config functions
* @param base The base directory config structure
* @param new The new directory config structure
*/
-void *ap_merge_per_dir_configs(apr_pool_t *p, void *base, void *new);
+ap_conf_vector_t *ap_merge_per_dir_configs(apr_pool_t *p,
+ ap_conf_vector_t *base,
+ ap_conf_vector_t *new);
/* For http_connection.c... */
/**
* @param p The pool to allocate the config vector out of
* @return The config vector
*/
-void *ap_create_conn_config(apr_pool_t *p);
+ap_conf_vector_t *ap_create_conn_config(apr_pool_t *p);
/* For http_core.c... (<Directory> command and virtual hosts) */
* @param access_name The list of possible names for .htaccess files
* int The status of the current request
*/
-int ap_parse_htaccess(void **result, request_rec *r, int override,
- const char *path, const char *access_name);
+int ap_parse_htaccess(ap_conf_vector_t **result, request_rec *r, int override,
+ const char *path, const char *access_name);
/**
* Setup a virtual host
* @deffunc int ap_rputc(int c, request_rec *r)
*/
AP_DECLARE(int) ap_rputc(int c, request_rec *r);
+
/**
* Output a string for the current request
* @param str The string to output
* @deffunc int ap_rputs(const char *str, request_rec *r)
*/
AP_DECLARE(int) ap_rputs(const char *str, request_rec *r);
+
/**
* Write a buffer for the current request
* @param buf The buffer to write
* @deffunc int ap_rwrite(const void *buf, int nbyte, request_rec *r)
*/
AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
+
/**
* Write an unspecified number of strings to the request
* @param r The current request
* @deffunc int ap_rvputs(request_rec *r, ...)
*/
AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...);
+
/**
* Output data to the client in a printf format
* @param r The current request
* @deffunc int ap_vrprintf(request_rec *r, const char *fmt, va_list vlist)
*/
AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist);
+
/**
* Output data to the client in a printf format
* @param r The current request
* @deffunc int ap_setup_cleint_block(request_rec *r, int read_policy)
*/
AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy);
+
/**
* Determine if the client has sent any data. This also sends a
* 100 Continue resposne to HTTP/1.1 clients, so modules should not be called
* @deffunc int ap_should_client_block(request_rec *r)
*/
AP_DECLARE(int) ap_should_client_block(request_rec *r);
+
/**
* Call this in a loop. It will put data into a buffer and return the length
* of the input block
* @deffunc long ap_get_client_block(request_rec *r, char *buffer, int bufsiz)
*/
AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz);
+
/**
* In HTTP/1.1, any method can have a body. However, most GET handlers
* wouldn't know what to do with a request body if they received one.
*/
AP_DECLARE(int) ap_discard_request_body(request_rec *r);
+
/* Sending a byterange */
/**
* @deffunc void ap_note_auth_failure(request_rec *r)
*/
AP_DECLARE(void) ap_note_auth_failure(request_rec *r);
+
/**
* Setup the output headers so that the client knows how to authenticate
* itself the next time, if an authentication request failed. This function
* @deffunc void ap_note_basic_auth_failure(request_rec *r)
*/
AP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r);
+
/**
* Setup the output headers so that the client knows how to authenticate
* itself the next time, if an authentication request failed. This function
* @deffunc void ap_note_digest_auth_failure(request_rec *r)
*/
AP_DECLARE(void) ap_note_digest_auth_failure(request_rec *r);
+
/**
* Get the password from the request headers
* @param r The current request
* @deffunc ap_run_post_read_request(request_rec *r)
*/
AP_DECLARE_HOOK(int,post_read_request,(request_rec *r))
+
/**
* This hook allows modules to perform any module-specific logging activities
* over and above the normal server things.
* @deffunc int ap_run_log_transaction(request_rec *r)
*/
AP_DECLARE_HOOK(int,log_transaction,(request_rec *r))
+
/**
* This hook allows modules to retrieve the http method from a request. This
* allows Apache modules to easily extend the methods that Apache understands
* @deffunc const char *ap_run_http_method(const request_rec *r)
*/
AP_DECLARE_HOOK(const char *,http_method,(const request_rec *r))
+
/**
* Return the default port from the current request
* @param r The current request
AP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *r))
typedef struct ap_bucket_error ap_bucket_error;
+
/**
* A bucket referring to an HTTP error
* This bucket can be passed down the filter stack to indicate that an
/** the overrides allowed for the .htaccess file */
int override;
/** the configuration directives */
- void *htaccess;
+ struct ap_conf_vector_t *htaccess;
/** the next one, or NULL if no more; N.B. never change this */
const struct htaccess_result *next;
};
*/
/** Options set in config files, etc. */
- void *per_dir_config;
+ struct ap_conf_vector_t *per_dir_config;
/** Notes on *this* request */
- void *request_config;
+ struct ap_conf_vector_t *request_config;
/**
* a linked list of the configuration directives in the .htaccess files
/** ID of this connection; unique at any point in time */
long id;
/** Notes on *this* connection */
- void *conn_config;
+ struct ap_conf_vector_t *conn_config;
/** send note from one module to another, must remain valid for all
* requests on this conn */
apr_table_t *notes;
int is_virtual;
/** Config vector containing pointers to modules' per-server config
* structures. */
- void *module_config;
+ struct ap_conf_vector_t *module_config;
/** MIME type info, etc., before we start checking per-directory info */
- void *lookup_defaults;
+ struct ap_conf_vector_t *lookup_defaults;
/* Transaction handling */
cleanup_tables(NULL);
}
+#if APR_HAS_SHARED_MEMORY
+
static void initialize_tables(server_rec *s, apr_pool_t *ctx)
{
unsigned long idx;
return;
}
+#endif /* APR_HAS_SHARED_MEMORY */
+
+
static void initialize_module(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
static const char *set_scriptlog(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgi_server_conf *conf =
- (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module);
+ cgi_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgi_module);
conf->logname = arg;
return NULL;
const char *arg)
{
server_rec *s = cmd->server;
- cgi_server_conf *conf =
- (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module);
+ cgi_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgi_module);
conf->logbytes = atol(arg);
return NULL;
const char *arg)
{
server_rec *s = cmd->server;
- cgi_server_conf *conf =
- (cgi_server_conf *) ap_get_module_config(s->module_config, &cgi_module);
+ cgi_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgi_module);
conf->bufbytes = atoi(arg);
return NULL;
apr_procattr_t *procattr;
apr_proc_t *procnew;
apr_status_t rc = APR_SUCCESS;
+
#if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \
defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS)
- core_dir_config *conf;
- conf = (core_dir_config *) ap_get_module_config(r->per_dir_config, &core_module);
+
+ core_dir_config *conf = ap_get_module_config(r->per_dir_config,
+ &core_module);
#endif
mode_t omask;
apr_socklen_t len;
server_rec *main_server = data;
- cgid_server_conf *sconf = (cgid_server_conf *)ap_get_module_config(
- main_server->module_config, &cgid_module);
+ cgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
+ &cgid_module);
apr_signal(SIGCHLD, SIG_IGN);
if (unlink(sconf->sockname) < 0 && errno != ENOENT) {
static const char *set_scriptlog(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgid_server_conf *conf =
- (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgid_module);
conf->logname = arg;
return NULL;
static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgid_server_conf *conf =
- (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgid_module);
conf->logbytes = atol(arg);
return NULL;
static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgid_server_conf *conf =
- (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgid_module);
conf->bufbytes = atoi(arg);
return NULL;
static const char *set_script_socket(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
- cgid_server_conf *conf =
- (cgid_server_conf *) ap_get_module_config(s->module_config, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(s->module_config,
+ &cgid_module);
conf->sockname = ap_server_root_relative(cmd->pool, arg);
return NULL;
apr_bucket_brigade *bb;
apr_bucket *b;
char argsbuffer[HUGE_STRING_LEN];
- void *sconf;
cgid_server_conf *conf;
int is_included;
int sd;
return DECLINED;
}
- sconf = r->server->module_config;
- conf = (cgid_server_conf *) ap_get_module_config(sconf, &cgid_module);
+ conf = ap_get_module_config(r->server->module_config, &cgid_module);
is_included = !strcmp(r->protocol, "INCLUDED");
if ((argv0 = strrchr(r->filename, '/')) != NULL)
apr_bucket *b;
struct sockaddr_un unix_addr;
apr_file_t *tempsock = NULL;
- void *sconf = r->server->module_config;
- cgid_server_conf *conf = (cgid_server_conf *) ap_get_module_config(sconf, &cgid_module);
+ cgid_server_conf *conf = ap_get_module_config(r->server->module_config,
+ &cgid_module);
add_ssi_vars(r, f->next);
env = ap_create_environment(r->pool, r->subprocess_env);
conf->limit_req_body = 0;
conf->limit_xml_body = AP_LIMIT_UNSET;
- conf->sec = apr_array_make(a, 2, sizeof(void *));
+ conf->sec = apr_array_make(a, 2, sizeof(ap_conf_vector_t *));
#ifdef WIN32
conf->script_interpreter_source = INTERPRETER_SOURCE_UNSET;
#endif
#endif
conf->access_name = is_virtual ? NULL : DEFAULT_ACCESS_FNAME;
conf->ap_document_root = is_virtual ? NULL : DOCUMENT_LOCATION;
- conf->sec = apr_array_make(a, 40, sizeof(void *));
- conf->sec_url = apr_array_make(a, 40, sizeof(void *));
+ conf->sec = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
+ conf->sec_url = apr_array_make(a, 40, sizeof(ap_conf_vector_t *));
return (void *)conf;
}
* components (where a "special" section has infinite components).
*/
struct reorder_sort_rec {
- void *elt;
+ ap_conf_vector_t *elt;
int orig_index;
};
core_dir_config *core_a;
core_dir_config *core_b;
- core_a = (core_dir_config *)ap_get_module_config(a->elt, &core_module);
- core_b = (core_dir_config *)ap_get_module_config(b->elt, &core_module);
+ core_a = ap_get_module_config(a->elt, &core_module);
+ core_b = ap_get_module_config(b->elt, &core_module);
if (IS_SPECIAL(core_a)) {
if (!IS_SPECIAL(core_b)) {
return 1;
apr_array_header_t *sec;
struct reorder_sort_rec *sortbin;
int nelts;
- void **elts;
+ ap_conf_vector_t **elts;
int i;
apr_pool_t *tmp;
sconf = ap_get_module_config(s->module_config, &core_module);
sec = sconf->sec;
nelts = sec->nelts;
- elts = (void **)sec->elts;
+ elts = (ap_conf_vector_t **)sec->elts;
/* we have to allocate tmp space to do a stable sort */
apr_pool_create(&tmp, p);
static int directory_walk(request_rec *r)
{
core_server_config *sconf = ap_get_module_config(r->server->module_config,
- &core_module);
- void *per_dir_defaults = r->server->lookup_defaults;
- void **sec = (void **) sconf->sec->elts;
+ &core_module);
+ ap_conf_vector_t *per_dir_defaults = r->server->lookup_defaults;
+ ap_conf_vector_t **sec = (ap_conf_vector_t **) sconf->sec->elts;
int num_sec = sconf->sec->nelts;
char *test_filename;
char *test_dirname;
#if defined(HAVE_UNC_PATHS) || defined(NETWARE)
unsigned iStart = 1;
#endif
+ ap_conf_vector_t *entry_config;
+ ap_conf_vector_t *this_conf;
+ core_dir_config *entry_core;
/*
* Are we dealing with a file? If not, we can (hopefuly) safely assume we
if (!ap_os_is_path_absolute(r->filename))
{
- void *this_conf, *entry_config;
- core_dir_config *entry_core;
- char *entry_dir;
+ const char *entry_dir;
for (j = 0; j < num_sec; ++j) {
entry_config = sec[j];
-
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_core = ap_get_module_config(entry_config, &core_module);
entry_dir = entry_core->d;
this_conf = NULL;
if (this_conf)
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
- per_dir_defaults,
- this_conf);
+ per_dir_defaults,
+ this_conf);
}
r->per_dir_config = per_dir_defaults;
/* XXX This needs to be rolled into APR, the APR function will not
* be allowed to fold the case of any non-existant segment of the path:
*/
- r->filename = ap_os_case_canonical_filename(r->pool, r->filename);
+ r->filename = ap_os_case_canonical_filename(r->pool, r->filename);
/* TODO This is rather silly right here, we should simply be setting
* filename and path_info at the end of our directory_walk
return res;
}
- /* XXX This becomes mute, and will already happen above for elements
+ /* XXX This becomes moot, and will already happen above for elements
* that actually exist:
*/
- r->filename = ap_os_canonical_filename(r->pool, r->filename);
+ r->filename = ap_os_canonical_filename(r->pool, r->filename);
test_filename = apr_pstrdup(r->pool, r->filename);
j = 0;
for (; i <= num_dirs; ++i) {
int overrides_here;
- core_dir_config *core_dir = (core_dir_config *)
- ap_get_module_config(per_dir_defaults, &core_module);
+ core_dir_config *core_dir = ap_get_module_config(per_dir_defaults,
+ &core_module);
/*
* XXX: this could be made faster by only copying the next component
*/
for (; j < num_sec; ++j) {
- void *entry_config = sec[j];
- core_dir_config *entry_core;
char *entry_dir;
- void *this_conf;
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_config = sec[j];
+ entry_core = ap_get_module_config(entry_config, &core_module);
entry_dir = entry_core->d;
if (entry_core->r
* XXX: The net test may be wrong... may fail ap_os_is_path_absolute
*/
|| (entry_core->d_components > 1
- && entry_core->d_components > i))
+ && entry_core->d_components > i)
#else
- || entry_core->d_components > i)
-#endif /* def HAVE_DRIVE_LETTERS || NETWARE */
+ || entry_core->d_components > i
+#endif /* def HAVE_DRIVE_LETTERS || NETWARE */
+ )
break;
this_conf = NULL;
if (this_conf) {
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
- per_dir_defaults,
- this_conf);
- core_dir = (core_dir_config *)
- ap_get_module_config(per_dir_defaults, &core_module);
+ per_dir_defaults,
+ this_conf);
+ core_dir = ap_get_module_config(per_dir_defaults,
+ &core_module);
}
#if defined(HAVE_DRIVE_LETTERS) || defined(NETWARE)
/* So that other top-level directory sections (e.g. "e:/") aren't
if (i >= iStart)
#endif
if (overrides_here) {
- void *htaccess_conf = NULL;
+ ap_conf_vector_t *htaccess_conf = NULL;
res = ap_parse_htaccess(&htaccess_conf, r, overrides_here,
- apr_pstrdup(r->pool, test_dirname),
- sconf->access_name);
+ apr_pstrdup(r->pool, test_dirname),
+ sconf->access_name);
if (res)
return res;
* regexes.
*/
for (; j < num_sec; ++j) {
- void *entry_config = sec[j];
- core_dir_config *entry_core;
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_config = sec[j];
+ entry_core = ap_get_module_config(entry_config, &core_module);
if (entry_core->r) {
if (!ap_regexec(entry_core->r, test_dirname, 0, NULL, REG_NOTEOL)) {
- per_dir_defaults =
- ap_merge_per_dir_configs(r->pool, per_dir_defaults,
- entry_config);
+ per_dir_defaults = ap_merge_per_dir_configs(r->pool,
+ per_dir_defaults,
+ entry_config);
}
}
}
static int location_walk(request_rec *r)
{
core_server_config *sconf = ap_get_module_config(r->server->module_config,
- &core_module);
- void *per_dir_defaults = r->per_dir_config;
- void **url = (void **) sconf->sec_url->elts;
+ &core_module);
+ ap_conf_vector_t *per_dir_defaults = r->per_dir_config;
+ ap_conf_vector_t **url = (ap_conf_vector_t **) sconf->sec_url->elts;
int len, num_url = sconf->sec_url->nelts;
char *test_location;
- void *this_conf, *entry_config;
+ ap_conf_vector_t *this_conf;
+ ap_conf_vector_t *entry_config;
core_dir_config *entry_core;
char *entry_url;
int j;
entry_config = url[j];
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_core = ap_get_module_config(entry_config, &core_module);
entry_url = entry_core->d;
len = strlen(entry_url);
}
}
else if (!strncmp(test_location, entry_url, len) &&
- (entry_url[len - 1] == '/' ||
- test_location[len] == '/' || test_location[len] == '\0'))
+ (entry_url[len - 1] == '/' ||
+ test_location[len] == '/' || test_location[len] == '\0'))
this_conf = entry_config;
if (this_conf)
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
- per_dir_defaults, this_conf);
+ per_dir_defaults,
+ this_conf);
}
r->per_dir_config = per_dir_defaults;
static int file_walk(request_rec *r)
{
- core_dir_config *conf = ap_get_module_config(r->per_dir_config, &core_module);
- void *per_dir_defaults = r->per_dir_config;
- void **file = (void **) conf->sec->elts;
+ core_dir_config *conf = ap_get_module_config(r->per_dir_config,
+ &core_module);
+ ap_conf_vector_t *per_dir_defaults = r->per_dir_config;
+ ap_conf_vector_t **file = (ap_conf_vector_t **) conf->sec->elts;
int num_files = conf->sec->nelts;
char *test_file;
/* Go through the file entries, and check for matches. */
if (num_files) {
- void *this_conf, *entry_config;
+ ap_conf_vector_t *this_conf;
+ ap_conf_vector_t *entry_config;
core_dir_config *entry_core;
char *entry_file;
int j;
entry_config = file[j];
- entry_core = (core_dir_config *)
- ap_get_module_config(entry_config, &core_module);
+ entry_core = ap_get_module_config(entry_config, &core_module);
entry_file = entry_core->d;
this_conf = NULL;
if (this_conf)
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
- per_dir_defaults,
- this_conf);
+ per_dir_defaults,
+ this_conf);
}
r->per_dir_config = per_dir_defaults;
}
int use_regex)
{
server_rec *s = cmd->server;
- alias_server_conf *conf =
- (alias_server_conf *) ap_get_module_config(s->module_config, &alias_module);
+ alias_server_conf *conf = ap_get_module_config(s->module_config,
+ &alias_module);
alias_entry *new = apr_array_push(conf->aliases);
/* XX r can NOT be relative to DocumentRoot here... compat bug. */
{
alias_entry *new;
server_rec *s = cmd->server;
- alias_server_conf *serverconf =
- (alias_server_conf *) ap_get_module_config(s->module_config, &alias_module);
+ alias_server_conf *serverconf = ap_get_module_config(s->module_config,
+ &alias_module);
int status = (int) (long) cmd->info;
regex_t *r = NULL;
const char *f = arg2;
static int translate_alias_redir(request_rec *r)
{
- void *sconf = r->server->module_config;
- alias_server_conf *serverconf =
- (alias_server_conf *) ap_get_module_config(sconf, &alias_module);
+ ap_conf_vector_t *sconf = r->server->module_config;
+ alias_server_conf *serverconf = ap_get_module_config(sconf, &alias_module);
char *ret;
int status;
static const char *cache_negotiated_docs(cmd_parms *cmd, void *dummy,
int arg)
{
- void *server_conf = cmd->server->module_config;
-
- ap_set_module_config(server_conf, &negotiation_module,
- (arg ? "Cache" : NULL));
+ ap_set_module_config(cmd->server->module_config, &negotiation_module,
+ (arg ? "Cache" : NULL));
return NULL;
}
rewrite_perdir_conf *dconf = in_dconf;
rewrite_server_conf *sconf;
- sconf =
- (rewrite_server_conf *)ap_get_module_config(cmd->server->module_config,
- &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
if (cmd->path == NULL) { /* is server command */
sconf->state = (flag ? ENGINE_ENABLED : ENGINE_DISABLED);
rewrite_server_conf *sconf;
const char *err;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
if (cmd->path == NULL) { /* is server command */
err = cmd_rewriteoptions_setoption(cmd->pool,
{
rewrite_server_conf *sconf;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
sconf->rewritelogfile = a1;
{
rewrite_server_conf *sconf;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
sconf->rewriteloglevel = atoi(a1);
rewritemap_entry *newmap;
apr_finfo_t st;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
newmap = apr_array_push(sconf->rewritemaps);
const char *err;
int rc;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
/* make a new entry in the internal temporary rewrite rule list */
if (cmd->path == NULL) { /* is server command */
const char *err;
int mode;
- sconf = (rewrite_server_conf *)
- ap_get_module_config(cmd->server->module_config, &rewrite_module);
+ sconf = ap_get_module_config(cmd->server->module_config, &rewrite_module);
/* make a new entry in the internal rewrite rule list */
if (cmd->path == NULL) { /* is server command */
static int hook_uri2file(request_rec *r)
{
- void *sconf;
rewrite_server_conf *conf;
const char *var;
const char *thisserver;
/*
* retrieve the config structures
*/
- sconf = r->server->module_config;
- conf = (rewrite_server_conf *)ap_get_module_config(sconf,
- &rewrite_module);
+ conf = ap_get_module_config(r->server->module_config, &rewrite_module);
/*
* only do something under runtime if the engine is really enabled,
static char *lookup_map(request_rec *r, char *name, char *key)
{
- void *sconf;
rewrite_server_conf *conf;
apr_array_header_t *rewritemaps;
rewritemap_entry *entries;
int i;
/* get map configuration */
- sconf = r->server->module_config;
- conf = (rewrite_server_conf *)ap_get_module_config(sconf,
- &rewrite_module);
+ conf = ap_get_module_config(r->server->module_config, &rewrite_module);
rewritemaps = conf->rewritemaps;
entries = (rewritemap_entry *)rewritemaps->elts;
module userdir_module;
-typedef struct userdir_config {
+typedef struct {
int globally_disabled;
char *userdir;
apr_table_t *enabled_users;
apr_table_t *disabled_users;
-} userdir_config;
+} userdir_config;
/*
* Server config for this module: global disablement flag, a list of usernames
static void *create_userdir_config(apr_pool_t *p, server_rec *s)
{
- userdir_config
- * newcfg = (userdir_config *) apr_pcalloc(p, sizeof(userdir_config));
+ userdir_config *newcfg = apr_pcalloc(p, sizeof(*newcfg));
newcfg->globally_disabled = 0;
newcfg->userdir = DEFAULT_USER_DIR;
newcfg->enabled_users = apr_table_make(p, 4);
newcfg->disabled_users = apr_table_make(p, 4);
- return (void *) newcfg;
+
+ return newcfg;
}
#define O_DEFAULT 0
static const char *set_user_dir(cmd_parms *cmd, void *dummy, const char *arg)
{
- userdir_config
- * s_cfg = (userdir_config *) ap_get_module_config
- (
- cmd->server->module_config,
- &userdir_module
- );
+ userdir_config *s_cfg = ap_get_module_config(cmd->server->module_config,
+ &userdir_module);
char *username;
- const char
- *usernames = arg;
+ const char *usernames = arg;
char *kw = ap_getword_conf(cmd->pool, &usernames);
apr_table_t *usertable;
static int translate_userdir(request_rec *r)
{
- void *server_conf = r->server->module_config;
- const userdir_config *s_cfg =
- (userdir_config *) ap_get_module_config(server_conf, &userdir_module);
+ ap_conf_vector_t *server_conf = r->server->module_config;
+ const userdir_config *s_cfg = ap_get_module_config(server_conf,
+ &userdir_module);
char *name = r->uri;
const char *userdirs = s_cfg->userdir;
const char *w, *dname;
* If the URI doesn't match our basic pattern, we've nothing to do with
* it.
*/
- if (
- (s_cfg->userdir == NULL) ||
- (name[0] != '/') ||
- (name[1] != '~')
- ) {
+ if (s_cfg->userdir == NULL || name[0] != '/' || name[1] != '~') {
return DECLINED;
}
* If there's a global interdiction on UserDirs, check to see if this
* name is one of the Blessed.
*/
- if (
- s_cfg->globally_disabled &&
- (apr_table_get(s_cfg->enabled_users, w) == NULL)
- ) {
+ if (s_cfg->globally_disabled
+ && apr_table_get(s_cfg->enabled_users, w) == NULL) {
return DECLINED;
}
static void *create_env_dir_config(apr_pool_t *p, char *dummy)
{
- env_dir_config_rec *new =
- (env_dir_config_rec *) apr_palloc(p, sizeof(env_dir_config_rec));
- new->vars = apr_table_make(p, 50);
- new->unsetenv = "";
- new->vars_present = 0;
- return (void *) new;
+ env_dir_config_rec *conf = apr_palloc(p, sizeof(*conf));
+
+ conf->vars = apr_table_make(p, 50);
+ conf->unsetenv = "";
+ conf->vars_present = 0;
+
+ return conf;
}
static void *merge_env_dir_configs(apr_pool_t *p, void *basev, void *addv)
{
- env_dir_config_rec *base = (env_dir_config_rec *) basev;
- env_dir_config_rec *add = (env_dir_config_rec *) addv;
- env_dir_config_rec *new =
- (env_dir_config_rec *) apr_palloc(p, sizeof(env_dir_config_rec));
+ env_dir_config_rec *base = basev;
+ env_dir_config_rec *add = addv;
+ env_dir_config_rec *newconf = apr_palloc(p, sizeof(*newconf));
apr_table_t *new_table;
apr_table_entry_t *elts;
uenv = ap_getword_conf(p, &unset);
}
- new->vars = new_table;
+ newconf->vars = new_table;
- new->vars_present = base->vars_present || add->vars_present;
+ newconf->vars_present = base->vars_present || add->vars_present;
- return new;
+ return newconf;
}
static const char *add_env_module_vars_passed(cmd_parms *cmd, void *sconf_,
const char *arg)
{
- env_dir_config_rec *sconf=sconf_;
+ env_dir_config_rec *sconf = sconf_;
apr_table_t *vars = sconf->vars;
char *env_var;
char *name_ptr;
static const char *add_env_module_vars_set(cmd_parms *cmd, void *sconf_,
const char *arg)
{
- env_dir_config_rec *sconf=sconf_;
+ env_dir_config_rec *sconf = sconf_;
apr_table_t *vars = sconf->vars;
char *name, *value;
static const char *add_env_module_vars_unset(cmd_parms *cmd, void *sconf_,
const char *arg)
{
- env_dir_config_rec *sconf=sconf_;
+ env_dir_config_rec *sconf = sconf_;
+
+ sconf->unsetenv = sconf->unsetenv
+ ? apr_pstrcat(cmd->pool, sconf->unsetenv, " ", arg, NULL)
+ : arg;
- sconf->unsetenv = sconf->unsetenv ?
- apr_pstrcat(cmd->pool, sconf->unsetenv, " ", arg, NULL) :
- arg;
return NULL;
}
static void register_hooks(apr_pool_t *p)
{
- ap_hook_fixups(fixup_env_module,NULL,NULL,APR_HOOK_MIDDLE);
+ ap_hook_fixups(fixup_env_module, NULL, NULL, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA env_module =
static void *create_headers_config(apr_pool_t *p, server_rec *s)
{
- headers_conf *a =
- (headers_conf *) apr_pcalloc(p, sizeof(headers_conf));
+ headers_conf *conf = apr_pcalloc(p, sizeof(*conf));
- a->headers = apr_array_make(p, 2, sizeof(header_entry));
- return a;
+ conf->headers = apr_array_make(p, 2, sizeof(header_entry));
+
+ return conf;
}
static void *create_headers_dir_config(apr_pool_t *p, char *d)
{
- return (headers_conf *) create_headers_config(p, NULL);
+ return create_headers_config(p, NULL);
}
static void *merge_headers_config(apr_pool_t *p, void *basev, void *overridesv)
{
- headers_conf *a =
- (headers_conf *) apr_pcalloc(p, sizeof(headers_conf));
- headers_conf *base = (headers_conf *) basev, *overrides = (headers_conf *) overridesv;
+ headers_conf *newconf = apr_pcalloc(p, sizeof(*newconf));
+ headers_conf *base = basev;
+ headers_conf *overrides = overridesv;
- a->headers = apr_array_append(p, base->headers, overrides->headers);
+ newconf->headers = apr_array_append(p, base->headers, overrides->headers);
- return a;
+ return newconf;
}
static const char *header_cmd(cmd_parms *cmd, void *indirconf,
- const char *action, const char *inhdr, const char *value)
+ const char *action, const char *inhdr,
+ const char *value)
{
headers_conf *dirconf = indirconf;
char *hdr = apr_pstrdup(cmd->pool, inhdr);
header_entry *new;
server_rec *s = cmd->server;
- headers_conf *serverconf =
- (headers_conf *) ap_get_module_config(s->module_config, &headers_module);
+ headers_conf *serverconf = ap_get_module_config(s->module_config,
+ &headers_module);
char *colon;
if (cmd->path) {
static int fixup_headers(request_rec *r)
{
- void *sconf = r->server->module_config;
- headers_conf *serverconf =
- (headers_conf *) ap_get_module_config(sconf, &headers_module);
- void *dconf = r->per_dir_config;
- headers_conf *dirconf =
- (headers_conf *) ap_get_module_config(dconf, &headers_module);
+ headers_conf *serverconf = ap_get_module_config(r->server->module_config,
+ &headers_module);
+ headers_conf *dirconf = ap_get_module_config(r->per_dir_config,
+ &headers_module);
do_headers_fixup(r, serverconf->headers);
do_headers_fixup(r, dirconf->headers);
static void register_hooks(apr_pool_t *p)
{
- ap_hook_fixups(fixup_headers,NULL,NULL,APR_HOOK_MIDDLE);
+ ap_hook_fixups(fixup_headers, NULL, NULL, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA headers_module =
* overridden).
*/
-#ifndef ap_get_module_config
-AP_DECLARE(void *) ap_get_module_config(void *conf_vector, module *m)
+static ap_conf_vector_t *create_empty_config(apr_pool_t *p)
{
- void **confv = (void **) conf_vector;
- return confv[m->module_index];
+ void *conf_vector = apr_pcalloc(p, sizeof(void *) *
+ (total_modules + DYNAMIC_MODULE_LIMIT));
+ return conf_vector;
}
-#endif
-
-#ifndef ap_set_module_config
-AP_DECLARE(void) ap_set_module_config(void *conf_vector, module *m, void *val)
-{
- void **confv = (void **) conf_vector;
- confv[m->module_index] = val;
-}
-#endif
-static void *create_empty_config(apr_pool_t *p)
+static ap_conf_vector_t *create_default_per_dir_config(apr_pool_t *p)
{
- void **conf_vector = (void **) apr_pcalloc(p, sizeof(void *) *
- (total_modules + DYNAMIC_MODULE_LIMIT));
- return (void *) conf_vector;
-}
-
-static void *create_default_per_dir_config(apr_pool_t *p)
-{
- void **conf_vector = (void **) apr_pcalloc(p, sizeof(void *) * (total_modules + DYNAMIC_MODULE_LIMIT));
+ void **conf_vector = apr_pcalloc(p, sizeof(void *) *
+ (total_modules + DYNAMIC_MODULE_LIMIT));
module *modp;
for (modp = top_module; modp; modp = modp->next) {
conf_vector[modp->module_index] = (*df) (p, NULL);
}
- return (void *) conf_vector;
+ return (ap_conf_vector_t *) conf_vector;
}
-void *
- ap_merge_per_dir_configs(apr_pool_t *p, void *base, void *new)
+ap_conf_vector_t *ap_merge_per_dir_configs(apr_pool_t *p,
+ ap_conf_vector_t *base,
+ ap_conf_vector_t *new)
{
- void **conf_vector = (void **) apr_palloc(p, sizeof(void *) * total_modules);
+ void **conf_vector = apr_palloc(p, sizeof(void *) * total_modules);
void **base_vector = (void **) base;
void **new_vector = (void **) new;
module *modp;
conf_vector[i] = new_vector[i] ? new_vector[i] : base_vector[i];
}
- return (void *) conf_vector;
+ return (ap_conf_vector_t *) conf_vector;
}
-static void *create_server_config(apr_pool_t *p, server_rec *s)
+static ap_conf_vector_t *create_server_config(apr_pool_t *p, server_rec *s)
{
- void **conf_vector = (void **) apr_pcalloc(p, sizeof(void *) * (total_modules + DYNAMIC_MODULE_LIMIT));
+ void **conf_vector = apr_pcalloc(p, sizeof(void *) *
+ (total_modules + DYNAMIC_MODULE_LIMIT));
module *modp;
for (modp = top_module; modp; modp = modp->next) {
conf_vector[modp->module_index] = (*modp->create_server_config) (p, s);
}
- return (void *) conf_vector;
+ return (ap_conf_vector_t *) conf_vector;
}
-static void merge_server_configs(apr_pool_t *p, void *base, void *virt)
+static void merge_server_configs(apr_pool_t *p, ap_conf_vector_t *base,
+ ap_conf_vector_t *virt)
{
/* Can reuse the 'virt' vector for the spine of it, since we don't
* have to deal with the moral equivalent of .htaccess files here...
}
}
-void *ap_create_request_config(apr_pool_t *p)
+ap_conf_vector_t *ap_create_request_config(apr_pool_t *p)
{
return create_empty_config(p);
}
-void *ap_create_conn_config(apr_pool_t *p)
+ap_conf_vector_t *ap_create_conn_config(apr_pool_t *p)
{
return create_empty_config(p);
}
-AP_CORE_DECLARE(void *) ap_create_per_dir_config(apr_pool_t *p)
+AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p)
{
return create_empty_config(p);
}
AP_CORE_DECLARE(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod)
{
- void *mconfig = ap_get_module_config(config, mod);
- void *sconfig = ap_get_module_config(parms->server->module_config, mod);
+ ap_conf_vector_t *mconfig = ap_get_module_config(config, mod);
+ ap_conf_vector_t *sconfig = ap_get_module_config(parms->server->module_config, mod);
if (!mconfig && mod->create_dir_config) {
mconfig = (*mod->create_dir_config) (parms->pool, parms->path);
ap_cfg_closefile(cfp);
}
-AP_DECLARE(void)ap_process_config_tree(server_rec *s, ap_directive_t *conftree,
- apr_pool_t *p, apr_pool_t *ptemp)
+AP_DECLARE(void) ap_process_config_tree(server_rec *s,
+ ap_directive_t *conftree,
+ apr_pool_t *p, apr_pool_t *ptemp)
{
const char *errmsg;
cmd_parms parms;
}
}
-int ap_parse_htaccess(void **result, request_rec *r, int override,
- const char *d, const char *access_name) {
+int ap_parse_htaccess(ap_conf_vector_t **result, request_rec *r, int override,
+ const char *d, const char *access_name)
+{
configfile_t *f = NULL;
cmd_parms parms;
char *filename = NULL;
const struct htaccess_result *cache;
struct htaccess_result *new;
- void *dc = NULL;
+ ap_conf_vector_t *dc = NULL;
apr_status_t status;
-/* firstly, search cache */
+ /* firstly, search cache */
for (cache = r->htaccess; cache != NULL; cache = cache->next)
if (cache->override == override && strcmp(cache->dir, d) == 0) {
if (cache->htaccess != NULL)
*result = dc;
break;
} else {
- if (!APR_STATUS_IS_ENOENT(status) && !APR_STATUS_IS_ENOTDIR(status)) {
+ if (!APR_STATUS_IS_ENOENT(status)
+ && !APR_STATUS_IS_ENOTDIR(status)) {
ap_log_rerror(APLOG_MARK, APLOG_CRIT, status, r,
"%s pcfg_openfile: unable to check htaccess file, "
"ensure it is readable",
}
}
-/* cache it */
+ /* cache it */
new = apr_palloc(r->pool, sizeof(struct htaccess_result));
new->dir = parms.path;
new->override = override;
new->htaccess = dc;
-/* add to head of list */
+
+ /* add to head of list */
new->next = r->htaccess;
r->htaccess = new;
return OK;
}
-AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p, const char *hostname,
- server_rec *main_server, server_rec **ps)
+AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p,
+ const char *hostname,
+ server_rec *main_server,
+ server_rec **ps)
{
server_rec *s = (server_rec *) apr_pcalloc(p, sizeof(server_rec));
#include "apr_want.h"
#include "httpd.h"
+#include "http_config.h"
#ifdef AP_DEBUG
-# undef strchr
+
+/* get rid of the macros we defined in httpd.h */
+#undef strchr
+#undef strrchr
+#undef strstr
char *ap_strchr(char *s, int c)
{
return strchr(s,c);
}
-
const char *ap_strchr_c(const char *s, int c)
{
return strchr(s,c);
}
-
-# undef strrchr
-
char *ap_strrchr(char *s, int c)
{
return strrchr(s,c);
}
-
const char *ap_strrchr_c(const char *s, int c)
{
return strrchr(s,c);
}
-
-#undef strstr
-
char *ap_strstr(char *s, char *c)
{
return strstr(s,c);
}
-
const char *ap_strstr_c(const char *s, const char *c)
{
return strstr(s,c);
}
+
+AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
+ const module *m)
+{
+ return ((void **)cv)[m->module_index];
+}
+
+/**
+ * Generic accessors for other modules to set at their own module-specific
+ * data
+ * @param conf_vector The vector in which the modules configuration is stored.
+ * usually r->per_dir_config or s->module_config
+ * @param m The module to set the data for.
+ * @param val The module-specific data to set
+ * @deffunc void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val)
+ */
+AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
+ void *val)
+{
+ ((void **)cv)[m->module_index] = val;
+}
+
+
#endif /* AP_DEBUG */