1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #define APR_WANT_STRFUNC
21 #include "http_config.h"
22 #include "http_core.h"
24 /* Possibly get rid of the macros we defined in httpd.h */
38 #if defined(ap_strchr)
40 AP_DECLARE(char *) ap_strchr(char *s, int c);
43 AP_DECLARE(char *) ap_strchr(char *s, int c)
48 #if defined(ap_strchr_c)
50 AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
53 AP_DECLARE(const char *) ap_strchr_c(const char *s, int c)
58 #if defined(ap_strrchr)
60 AP_DECLARE(char *) ap_strrchr(char *s, int c);
63 AP_DECLARE(char *) ap_strrchr(char *s, int c)
68 #if defined(ap_strrchr_c)
70 AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
73 AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c)
78 #if defined(ap_strstr)
80 AP_DECLARE(char *) ap_strstr(char *s, const char *c);
83 AP_DECLARE(char *) ap_strstr(char *s, const char *c)
88 #if defined(ap_strstr_c)
90 AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
93 AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c)
98 #if defined(ap_get_module_config)
99 #undef ap_get_module_config
100 AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
104 AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
107 return ((void **)cv)[m->module_index];
110 #if defined(ap_get_core_module_config)
111 #undef ap_get_core_module_config
112 AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv);
115 AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv)
117 return ((void **)cv)[AP_CORE_MODULE_INDEX];
121 #if defined(ap_get_server_module_loglevel)
122 #undef ap_get_server_module_loglevel
123 AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int module_index);
126 AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int module_index)
128 if (module_index < 0 || s->log.module_levels == NULL ||
129 s->log.module_levels[module_index] < 0)
134 return s->log.module_levels[module_index];
137 #if defined(ap_get_conn_module_loglevel)
138 #undef ap_get_conn_module_loglevel
139 AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int module_index);
142 AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int module_index)
144 const struct ap_logconf *l = (c)->log ? (c)->log : &(c)->base_server->log;
145 if (module_index < 0 || l->module_levels == NULL ||
146 l->module_levels[module_index] < 0)
151 return l->module_levels[module_index];
154 #if defined(ap_get_conn_server_module_loglevel)
155 #undef ap_get_conn_server_module_loglevel
156 AP_DECLARE(int) ap_get_conn_server_module_loglevel(const conn_rec *c,
161 AP_DECLARE(int) ap_get_conn_server_module_loglevel(const conn_rec *c,
165 const struct ap_logconf *l = (c->log && c->log != &c->base_server->log) ?
167 if (module_index < 0 || l->module_levels == NULL ||
168 l->module_levels[module_index] < 0)
173 return l->module_levels[module_index];
176 #if defined(ap_get_request_module_loglevel)
177 #undef ap_get_request_module_loglevel
178 AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *c, int module_index);
181 AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *r, int module_index)
183 const struct ap_logconf *l = r->log ? r->log :
184 r->connection->log ? r->connection->log :
186 if (module_index < 0 || l->module_levels == NULL ||
187 l->module_levels[module_index] < 0)
192 return l->module_levels[module_index];
196 * Generic accessors for other modules to set at their own module-specific
198 * @param conf_vector The vector in which the modules configuration is stored.
199 * usually r->per_dir_config or s->module_config
200 * @param m The module to set the data for.
201 * @param val The module-specific data to set
202 * @fn void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val)
204 #if defined(ap_set_module_config)
205 #undef ap_set_module_config
206 AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
210 AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
213 ((void **)cv)[m->module_index] = val;
217 #if defined(ap_set_core_module_config)
218 #undef ap_set_core_module_config
219 AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val);
222 AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val)
224 ((void **)cv)[AP_CORE_MODULE_INDEX] = val;
227 #if defined(apr_palloc)
230 AP_DECLARE(void *) ap_palloc_debug(apr_pool_t *p, apr_size_t size)
232 /* poison uninitialized memory */
233 return memset(apr_palloc(p, size), 0xEE, size);
236 #if defined(apr_pcalloc)
239 AP_DECLARE(void *) ap_pcalloc_debug(apr_pool_t *p, apr_size_t size)
241 return memset(apr_palloc(p, size), 0, size);