|
Packit |
90a5c9 |
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
90a5c9 |
* contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
90a5c9 |
* this work for additional information regarding copyright ownership.
|
|
Packit |
90a5c9 |
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
90a5c9 |
* (the "License"); you may not use this file except in compliance with
|
|
Packit |
90a5c9 |
* the License. You may obtain a copy of the License at
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
90a5c9 |
*
|
|
Packit |
90a5c9 |
* Unless required by applicable law or agreed to in writing, software
|
|
Packit |
90a5c9 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
90a5c9 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
90a5c9 |
* See the License for the specific language governing permissions and
|
|
Packit |
90a5c9 |
* limitations under the License.
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#define APR_WANT_STRFUNC
|
|
Packit |
90a5c9 |
#include "apr_want.h"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#include "httpd.h"
|
|
Packit |
90a5c9 |
#include "http_config.h"
|
|
Packit |
90a5c9 |
#include "http_core.h"
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/* Possibly get rid of the macros we defined in httpd.h */
|
|
Packit |
90a5c9 |
#if defined(strchr)
|
|
Packit |
90a5c9 |
#undef strchr
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined (strrchr)
|
|
Packit |
90a5c9 |
#undef strrchr
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined (strstr)
|
|
Packit |
90a5c9 |
#undef strstr
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_strchr)
|
|
Packit |
90a5c9 |
#undef ap_strchr
|
|
Packit |
90a5c9 |
AP_DECLARE(char *) ap_strchr(char *s, int c);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(char *) ap_strchr(char *s, int c)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return strchr(s,c);
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_strchr_c)
|
|
Packit |
90a5c9 |
#undef ap_strchr_c
|
|
Packit |
90a5c9 |
AP_DECLARE(const char *) ap_strchr_c(const char *s, int c);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(const char *) ap_strchr_c(const char *s, int c)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return strchr(s,c);
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_strrchr)
|
|
Packit |
90a5c9 |
#undef ap_strrchr
|
|
Packit |
90a5c9 |
AP_DECLARE(char *) ap_strrchr(char *s, int c);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(char *) ap_strrchr(char *s, int c)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return strrchr(s,c);
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_strrchr_c)
|
|
Packit |
90a5c9 |
#undef ap_strrchr_c
|
|
Packit |
90a5c9 |
AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return strrchr(s,c);
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_strstr)
|
|
Packit |
90a5c9 |
#undef ap_strstr
|
|
Packit |
90a5c9 |
AP_DECLARE(char *) ap_strstr(char *s, const char *c);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(char *) ap_strstr(char *s, const char *c)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return strstr(s,c);
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_strstr_c)
|
|
Packit |
90a5c9 |
#undef ap_strstr_c
|
|
Packit |
90a5c9 |
AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return strstr(s,c);
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_get_module_config)
|
|
Packit |
90a5c9 |
#undef ap_get_module_config
|
|
Packit |
90a5c9 |
AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
|
|
Packit |
90a5c9 |
const module *m);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
|
|
Packit |
90a5c9 |
const module *m)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return ((void **)cv)[m->module_index];
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_module_flags(const module *m)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
if (m->version < AP_MODULE_FLAGS_MMN_MAJOR
|
|
Packit |
90a5c9 |
|| (m->version == AP_MODULE_FLAGS_MMN_MAJOR
|
|
Packit |
90a5c9 |
&& (m->minor_version < AP_MODULE_FLAGS_MMN_MINOR))) {
|
|
Packit |
90a5c9 |
return 0;
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
return m->flags;
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_get_core_module_config)
|
|
Packit |
90a5c9 |
#undef ap_get_core_module_config
|
|
Packit |
90a5c9 |
AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(void *) ap_get_core_module_config(const ap_conf_vector_t *cv)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return ((void **)cv)[AP_CORE_MODULE_INDEX];
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_get_server_module_loglevel)
|
|
Packit |
90a5c9 |
#undef ap_get_server_module_loglevel
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int module_index);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int module_index)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
if (module_index < 0 || s->log.module_levels == NULL ||
|
|
Packit |
90a5c9 |
s->log.module_levels[module_index] < 0)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return s->log.level;
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
return s->log.module_levels[module_index];
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_get_conn_module_loglevel)
|
|
Packit |
90a5c9 |
#undef ap_get_conn_module_loglevel
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int module_index);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int module_index)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
const struct ap_logconf *l = (c)->log ? (c)->log : &(c)->base_server->log;
|
|
Packit |
90a5c9 |
if (module_index < 0 || l->module_levels == NULL ||
|
|
Packit |
90a5c9 |
l->module_levels[module_index] < 0)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return l->level;
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
return l->module_levels[module_index];
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_get_conn_server_module_loglevel)
|
|
Packit |
90a5c9 |
#undef ap_get_conn_server_module_loglevel
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_conn_server_module_loglevel(const conn_rec *c,
|
|
Packit |
90a5c9 |
const server_rec *s,
|
|
Packit |
90a5c9 |
int module_index);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_conn_server_module_loglevel(const conn_rec *c,
|
|
Packit |
90a5c9 |
const server_rec *s,
|
|
Packit |
90a5c9 |
int module_index)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
const struct ap_logconf *l = (c->log && c->log != &c->base_server->log) ?
|
|
Packit |
90a5c9 |
c->log : &s->log;
|
|
Packit |
90a5c9 |
if (module_index < 0 || l->module_levels == NULL ||
|
|
Packit |
90a5c9 |
l->module_levels[module_index] < 0)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return l->level;
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
return l->module_levels[module_index];
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_get_request_module_loglevel)
|
|
Packit |
90a5c9 |
#undef ap_get_request_module_loglevel
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *c, int module_index);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *r, int module_index)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
const struct ap_logconf *l = r->log ? r->log :
|
|
Packit |
90a5c9 |
r->connection->log ? r->connection->log :
|
|
Packit |
90a5c9 |
&r->server->log;
|
|
Packit |
90a5c9 |
if (module_index < 0 || l->module_levels == NULL ||
|
|
Packit |
90a5c9 |
l->module_levels[module_index] < 0)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
return l->level;
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
return l->module_levels[module_index];
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
/**
|
|
Packit |
90a5c9 |
* Generic accessors for other modules to set at their own module-specific
|
|
Packit |
90a5c9 |
* data
|
|
Packit |
90a5c9 |
* @param conf_vector The vector in which the modules configuration is stored.
|
|
Packit |
90a5c9 |
* usually r->per_dir_config or s->module_config
|
|
Packit |
90a5c9 |
* @param m The module to set the data for.
|
|
Packit |
90a5c9 |
* @param val The module-specific data to set
|
|
Packit |
90a5c9 |
* @fn void ap_set_module_config(ap_conf_vector_t *cv, const module *m, void *val)
|
|
Packit |
90a5c9 |
*/
|
|
Packit |
90a5c9 |
#if defined(ap_set_module_config)
|
|
Packit |
90a5c9 |
#undef ap_set_module_config
|
|
Packit |
90a5c9 |
AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
|
|
Packit |
90a5c9 |
void *val);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
|
|
Packit |
90a5c9 |
void *val)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
((void **)cv)[m->module_index] = val;
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
#if defined(ap_set_core_module_config)
|
|
Packit |
90a5c9 |
#undef ap_set_core_module_config
|
|
Packit |
90a5c9 |
AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val);
|
|
Packit |
90a5c9 |
#endif
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
AP_DECLARE(void) ap_set_core_module_config(ap_conf_vector_t *cv, void *val)
|
|
Packit |
90a5c9 |
{
|
|
Packit |
90a5c9 |
((void **)cv)[AP_CORE_MODULE_INDEX] = val;
|
|
Packit |
90a5c9 |
}
|