mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
*) Introduce "ap_conf_vector_t" type to assist with legibility and provide
some type safety. (unfortunately, our old "void*" is type-safe with the new one, but over time we should be better) *) Propagate the new type to all appropriate functions. *) Random cleaning, whitespace, stylistic nits. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88225 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -431,7 +431,12 @@ struct module_struct {
|
||||
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
|
||||
@@ -439,11 +444,11 @@ struct module_struct {
|
||||
* 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
|
||||
@@ -451,16 +456,21 @@ AP_DECLARE(void *) ap_get_module_config(void *conf_vector, module *m);
|
||||
* 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
|
||||
@@ -820,7 +830,7 @@ AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server);
|
||||
* @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
|
||||
@@ -828,7 +838,7 @@ void *ap_create_request_config(apr_pool_t *p);
|
||||
* @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
|
||||
@@ -836,7 +846,9 @@ AP_CORE_DECLARE(void *) ap_create_per_dir_config(apr_pool_t *p);
|
||||
* @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... */
|
||||
/**
|
||||
@@ -844,7 +856,7 @@ void *ap_merge_per_dir_configs(apr_pool_t *p, void *base, void *new);
|
||||
* @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) */
|
||||
|
||||
@@ -857,7 +869,7 @@ void *ap_create_conn_config(apr_pool_t *p);
|
||||
* @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,
|
||||
int ap_parse_htaccess(ap_conf_vector_t **result, request_rec *r, int override,
|
||||
const char *path, const char *access_name);
|
||||
|
||||
/**
|
||||
|
@@ -311,6 +311,7 @@ AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l);
|
||||
* @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
|
||||
@@ -319,6 +320,7 @@ AP_DECLARE(int) ap_rputc(int c, request_rec *r);
|
||||
* @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
|
||||
@@ -328,6 +330,7 @@ AP_DECLARE(int) ap_rputs(const char *str, request_rec *r);
|
||||
* @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
|
||||
@@ -336,6 +339,7 @@ AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r);
|
||||
* @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
|
||||
@@ -345,6 +349,7 @@ AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...);
|
||||
* @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
|
||||
@@ -397,6 +402,7 @@ AP_DECLARE(const char *) ap_get_status_line(int status);
|
||||
* @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
|
||||
@@ -407,6 +413,7 @@ AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy);
|
||||
* @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
|
||||
@@ -418,6 +425,7 @@ AP_DECLARE(int) ap_should_client_block(request_rec *r);
|
||||
* @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.
|
||||
@@ -431,6 +439,7 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz);
|
||||
*/
|
||||
AP_DECLARE(int) ap_discard_request_body(request_rec *r);
|
||||
|
||||
|
||||
/* Sending a byterange */
|
||||
|
||||
/**
|
||||
@@ -441,6 +450,7 @@ AP_DECLARE(int) ap_discard_request_body(request_rec *r);
|
||||
* @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
|
||||
@@ -449,6 +459,7 @@ AP_DECLARE(void) ap_note_auth_failure(request_rec *r);
|
||||
* @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
|
||||
@@ -457,6 +468,7 @@ AP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r);
|
||||
* @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
|
||||
@@ -528,6 +540,7 @@ AP_DECLARE(const char *) ap_method_name_of(int methnum);
|
||||
* @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.
|
||||
@@ -536,6 +549,7 @@ AP_DECLARE_HOOK(int,post_read_request,(request_rec *r))
|
||||
* @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
|
||||
@@ -544,6 +558,7 @@ AP_DECLARE_HOOK(int,log_transaction,(request_rec *r))
|
||||
* @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
|
||||
@@ -553,6 +568,7 @@ AP_DECLARE_HOOK(const char *,http_method,(const request_rec *r))
|
||||
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
|
||||
|
@@ -505,7 +505,7 @@ struct htaccess_result {
|
||||
/** 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;
|
||||
};
|
||||
@@ -729,9 +729,9 @@ struct request_rec {
|
||||
*/
|
||||
|
||||
/** 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
|
||||
@@ -811,7 +811,7 @@ struct conn_rec {
|
||||
/** 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;
|
||||
@@ -883,9 +883,9 @@ struct server_rec {
|
||||
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 */
|
||||
|
||||
|
@@ -325,6 +325,8 @@ static void log_error_and_cleanup(char *msg, apr_status_t sts, server_rec *s)
|
||||
cleanup_tables(NULL);
|
||||
}
|
||||
|
||||
#if APR_HAS_SHARED_MEMORY
|
||||
|
||||
static void initialize_tables(server_rec *s, apr_pool_t *ctx)
|
||||
{
|
||||
unsigned long idx;
|
||||
@@ -392,6 +394,9 @@ static void initialize_tables(server_rec *s, apr_pool_t *ctx)
|
||||
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)
|
||||
{
|
||||
|
@@ -158,8 +158,8 @@ static void *merge_cgi_config(apr_pool_t *p, void *basev, void *overridesv)
|
||||
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;
|
||||
@@ -169,8 +169,8 @@ static const char *set_scriptlog_length(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->logbytes = atol(arg);
|
||||
return NULL;
|
||||
@@ -180,8 +180,8 @@ static const char *set_scriptlog_buffer(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->bufbytes = atoi(arg);
|
||||
return NULL;
|
||||
@@ -371,10 +371,12 @@ static apr_status_t run_cgi_child(apr_file_t **script_out,
|
||||
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
|
||||
|
||||
|
||||
|
@@ -440,8 +440,8 @@ static int cgid_server(void *data)
|
||||
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) {
|
||||
@@ -640,8 +640,8 @@ static void *merge_cgid_config(apr_pool_t *p, void *basev, void *overridesv)
|
||||
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;
|
||||
@@ -650,8 +650,8 @@ static const char *set_scriptlog(cmd_parms *cmd, void *dummy, const char *arg)
|
||||
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;
|
||||
@@ -660,8 +660,8 @@ static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy, const char
|
||||
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;
|
||||
@@ -670,8 +670,8 @@ static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy, const char
|
||||
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;
|
||||
@@ -820,7 +820,6 @@ static int cgid_handler(request_rec *r)
|
||||
apr_bucket_brigade *bb;
|
||||
apr_bucket *b;
|
||||
char argsbuffer[HUGE_STRING_LEN];
|
||||
void *sconf;
|
||||
cgid_server_conf *conf;
|
||||
int is_included;
|
||||
int sd;
|
||||
@@ -839,8 +838,7 @@ static int cgid_handler(request_rec *r)
|
||||
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)
|
||||
@@ -1125,8 +1123,8 @@ static int include_cmd(include_ctx_t *ctx, apr_bucket_brigade **bb, char *comman
|
||||
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);
|
||||
|
@@ -148,7 +148,7 @@ static void *create_core_dir_config(apr_pool_t *a, char *dir)
|
||||
|
||||
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
|
||||
@@ -318,8 +318,8 @@ static void *create_core_server_config(apr_pool_t *a, server_rec *s)
|
||||
#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;
|
||||
}
|
||||
@@ -406,7 +406,7 @@ AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config)
|
||||
* components (where a "special" section has infinite components).
|
||||
*/
|
||||
struct reorder_sort_rec {
|
||||
void *elt;
|
||||
ap_conf_vector_t *elt;
|
||||
int orig_index;
|
||||
};
|
||||
|
||||
@@ -417,8 +417,8 @@ static int reorder_sorter(const void *va, const void *vb)
|
||||
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;
|
||||
@@ -448,14 +448,14 @@ void ap_core_reorder_directories(apr_pool_t *p, server_rec *s)
|
||||
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);
|
||||
|
@@ -332,8 +332,8 @@ 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;
|
||||
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;
|
||||
@@ -343,6 +343,9 @@ static int directory_walk(request_rec *r)
|
||||
#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
|
||||
@@ -372,16 +375,12 @@ static int directory_walk(request_rec *r)
|
||||
|
||||
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;
|
||||
@@ -420,7 +419,7 @@ static int directory_walk(request_rec *r)
|
||||
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);
|
||||
@@ -500,8 +499,8 @@ static int directory_walk(request_rec *r)
|
||||
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
|
||||
@@ -530,13 +529,10 @@ static int directory_walk(request_rec *r)
|
||||
*/
|
||||
|
||||
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
|
||||
@@ -546,10 +542,11 @@ static int directory_walk(request_rec *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)
|
||||
|| entry_core->d_components > i
|
||||
#endif /* def HAVE_DRIVE_LETTERS || NETWARE */
|
||||
)
|
||||
break;
|
||||
|
||||
this_conf = NULL;
|
||||
@@ -565,8 +562,8 @@ static int directory_walk(request_rec *r)
|
||||
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);
|
||||
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
|
||||
@@ -587,7 +584,7 @@ static int directory_walk(request_rec *r)
|
||||
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),
|
||||
@@ -610,16 +607,14 @@ static int directory_walk(request_rec *r)
|
||||
* 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,
|
||||
per_dir_defaults = ap_merge_per_dir_configs(r->pool,
|
||||
per_dir_defaults,
|
||||
entry_config);
|
||||
}
|
||||
}
|
||||
@@ -649,11 +644,12 @@ 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;
|
||||
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;
|
||||
@@ -684,8 +680,7 @@ static int location_walk(request_rec *r)
|
||||
|
||||
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);
|
||||
@@ -708,7 +703,8 @@ static int location_walk(request_rec *r)
|
||||
|
||||
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;
|
||||
|
||||
@@ -717,9 +713,10 @@ static int location_walk(request_rec *r)
|
||||
|
||||
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;
|
||||
|
||||
@@ -735,7 +732,8 @@ static int file_walk(request_rec *r)
|
||||
/* 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;
|
||||
@@ -747,8 +745,7 @@ static int file_walk(request_rec *r)
|
||||
|
||||
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;
|
||||
|
@@ -138,8 +138,8 @@ static const char *add_alias_internal(cmd_parms *cmd, void *dummy,
|
||||
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. */
|
||||
@@ -182,8 +182,8 @@ static const char *add_redirect_internal(cmd_parms *cmd,
|
||||
{
|
||||
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;
|
||||
@@ -377,9 +377,8 @@ static char *try_alias_list(request_rec *r, apr_array_header_t *aliases, int doe
|
||||
|
||||
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;
|
||||
|
||||
|
@@ -127,9 +127,7 @@ static const char *set_language_priority(cmd_parms *cmd, void *n,
|
||||
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,
|
||||
ap_set_module_config(cmd->server->module_config, &negotiation_module,
|
||||
(arg ? "Cache" : NULL));
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -347,9 +347,7 @@ static const char *cmd_rewriteengine(cmd_parms *cmd,
|
||||
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);
|
||||
@@ -368,8 +366,7 @@ static const char *cmd_rewriteoptions(cmd_parms *cmd,
|
||||
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,
|
||||
@@ -400,8 +397,7 @@ static const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, const char *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->rewritelogfile = a1;
|
||||
|
||||
@@ -412,8 +408,7 @@ static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, const char *
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -427,8 +422,7 @@ static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *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);
|
||||
|
||||
@@ -546,8 +540,7 @@ static const char *cmd_rewritecond(cmd_parms *cmd, void *in_dconf,
|
||||
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 */
|
||||
@@ -691,8 +684,7 @@ static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf,
|
||||
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 */
|
||||
@@ -1012,7 +1004,6 @@ static void init_child(apr_pool_t *p, server_rec *s)
|
||||
|
||||
static int hook_uri2file(request_rec *r)
|
||||
{
|
||||
void *sconf;
|
||||
rewrite_server_conf *conf;
|
||||
const char *var;
|
||||
const char *thisserver;
|
||||
@@ -1030,9 +1021,7 @@ static int hook_uri2file(request_rec *r)
|
||||
/*
|
||||
* 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,
|
||||
@@ -2634,7 +2623,6 @@ static char *expand_tildepaths(request_rec *r, char *uri)
|
||||
|
||||
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;
|
||||
@@ -2645,9 +2633,7 @@ static char *lookup_map(request_rec *r, char *name, char *key)
|
||||
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;
|
||||
|
@@ -122,7 +122,7 @@
|
||||
|
||||
module userdir_module;
|
||||
|
||||
typedef struct userdir_config {
|
||||
typedef struct {
|
||||
int globally_disabled;
|
||||
char *userdir;
|
||||
apr_table_t *enabled_users;
|
||||
@@ -137,14 +137,14 @@ typedef struct userdir_config {
|
||||
|
||||
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
|
||||
@@ -153,15 +153,10 @@ static void *create_userdir_config(apr_pool_t *p, server_rec *s)
|
||||
|
||||
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;
|
||||
|
||||
@@ -219,9 +214,9 @@ static const command_rec userdir_cmds[] = {
|
||||
|
||||
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;
|
||||
@@ -233,11 +228,7 @@ static int translate_userdir(request_rec *r)
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -271,10 +262,8 @@ static int translate_userdir(request_rec *r)
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
@@ -122,20 +122,20 @@ module AP_MODULE_DECLARE_DATA env_module;
|
||||
|
||||
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;
|
||||
@@ -170,17 +170,17 @@ static void *merge_env_dir_configs(apr_pool_t *p, void *basev, void *addv)
|
||||
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;
|
||||
@@ -199,7 +199,7 @@ static const char *add_env_module_vars_passed(cmd_parms *cmd, void *sconf_,
|
||||
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;
|
||||
|
||||
@@ -224,11 +224,12 @@ static const char *add_env_module_vars_set(cmd_parms *cmd, void *sconf_,
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -260,7 +261,7 @@ static int fixup_env_module(request_rec *r)
|
||||
|
||||
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 =
|
||||
|
@@ -138,39 +138,40 @@ module AP_MODULE_DECLARE_DATA headers_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) {
|
||||
@@ -240,12 +241,10 @@ static void do_headers_fixup(request_rec *r, apr_array_header_t *headers)
|
||||
|
||||
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);
|
||||
@@ -255,7 +254,7 @@ static int fixup_headers(request_rec *r)
|
||||
|
||||
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 =
|
||||
|
@@ -166,32 +166,17 @@ typedef void *(*merger_func) (apr_pool_t *, void *, void *);
|
||||
* 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];
|
||||
}
|
||||
#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)
|
||||
{
|
||||
void **conf_vector = (void **) apr_pcalloc(p, sizeof(void *) *
|
||||
void *conf_vector = apr_pcalloc(p, sizeof(void *) *
|
||||
(total_modules + DYNAMIC_MODULE_LIMIT));
|
||||
return (void *) conf_vector;
|
||||
return conf_vector;
|
||||
}
|
||||
|
||||
static void *create_default_per_dir_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));
|
||||
void **conf_vector = apr_pcalloc(p, sizeof(void *) *
|
||||
(total_modules + DYNAMIC_MODULE_LIMIT));
|
||||
module *modp;
|
||||
|
||||
for (modp = top_module; modp; modp = modp->next) {
|
||||
@@ -201,13 +186,14 @@ static void *create_default_per_dir_config(apr_pool_t *p)
|
||||
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;
|
||||
@@ -222,12 +208,13 @@ void *
|
||||
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) {
|
||||
@@ -235,10 +222,11 @@ static void *create_server_config(apr_pool_t *p, server_rec *s)
|
||||
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...
|
||||
@@ -259,17 +247,17 @@ static void merge_server_configs(apr_pool_t *p, void *base, void *virt)
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -765,8 +753,8 @@ AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_
|
||||
|
||||
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);
|
||||
@@ -1356,7 +1344,8 @@ void ap_process_resource_config(server_rec *s, const char *fname,
|
||||
ap_cfg_closefile(cfp);
|
||||
}
|
||||
|
||||
AP_DECLARE(void)ap_process_config_tree(server_rec *s, ap_directive_t *conftree,
|
||||
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;
|
||||
@@ -1381,17 +1370,18 @@ AP_DECLARE(void)ap_process_config_tree(server_rec *s, ap_directive_t *conftree,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -1434,7 +1424,8 @@ int ap_parse_htaccess(void **result, request_rec *r, int override,
|
||||
*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",
|
||||
@@ -1447,20 +1438,23 @@ int ap_parse_htaccess(void **result, request_rec *r, int override,
|
||||
}
|
||||
}
|
||||
|
||||
/* 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));
|
||||
|
||||
|
@@ -60,42 +60,61 @@
|
||||
#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 */
|
||||
|
Reference in New Issue
Block a user