1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

More consification, correct command initialisation.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85599 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ben Laurie
2000-06-17 16:29:53 +00:00
parent 7a22b1a75a
commit c0a4cb7873
17 changed files with 180 additions and 101 deletions

View File

@@ -73,16 +73,17 @@ extern ap_listen_rec *ap_listeners;
void ap_listen_pre_config(void);
int ap_listen_open(process_rec *process, unsigned port);
const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg);
const char *ap_set_listener(cmd_parms *cmd, void *dummy, char *ips);
const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, char *arg);
const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg);
const char *ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips);
const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
const char *arg);
#define LISTEN_COMMANDS \
{ "ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, TAKE1, \
"Maximum length of the queue of pending connections, as used by listen(2)" }, \
{ "Listen", ap_set_listener, NULL, RSRC_CONF, TAKE1, \
"A port number or a numeric IP address and a port number"}, \
{ "SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, TAKE1, \
"Send buffer size in bytes"},
AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \
"Maximum length of the queue of pending connections, as used by listen(2)"), \
AP_INIT_TAKE1("Listen", ap_set_listener, NULL, RSRC_CONF, \
"A port number or a numeric IP address and a port number"), \
AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
"Send buffer size in bytes"),
#endif

View File

@@ -931,7 +931,7 @@ API_EXPORT(char *) ap_getword_nulls(ap_pool_t *p, const char **line, char stop);
API_EXPORT(char *) ap_getword_nulls_nc(ap_pool_t *p, char **line, char stop);
API_EXPORT(char *) ap_getword_conf(ap_pool_t *p, const char **line);
API_EXPORT(char *) ap_getword_conf_nc(ap_pool_t *p, char **line);
API_EXPORT(char *) ap_resolve_env(ap_pool_t *p, const char * word);
API_EXPORT(const char *) ap_resolve_env(ap_pool_t *p, const char * word);
API_EXPORT(const char *) ap_size_list_item(const char **field, int *len);
API_EXPORT(char *) ap_get_list_item(ap_pool_t *p, const char **field);
@@ -1050,13 +1050,18 @@ API_EXPORT(extern const char *) ap_psignature(const char *prefix, request_rec *r
*/
#ifdef AP_DEBUG
# define strchr(s, c) ap_strchr(s,c)
# define strrchr(s, c) ap_strrchr(s,c)
char *ap_strchr(char *s, int c);
const char *ap_strchr_c(const char *s, int c);
char *ap_strrchr(char *s, int c);
const char *ap_strrchr_c(const char *s, int c);
#else
# define ap_strchr(s, c) strchr(s, c)
# define ap_strchr_c(s, c) strchr(s, c)
# define ap_strrchr(s, c) strrchr(s, c)
# define ap_strrchr_c(s, c) strrchr(s, c)

View File

@@ -527,7 +527,7 @@ static void parse_string(request_rec *r, const char *in, char *out,
if (*in == '{') {
++in;
start_of_var_name = in;
in = strchr(in, '}');
in = ap_strchr_c(in, '}');
if (in == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR,
0, r, "Missing '}' on variable \"%s\"",
@@ -791,7 +791,7 @@ static ap_status_t build_argv_list(char ***argv, request_rec *r, ap_pool_t *p)
char *w;
const char *args = r->args;
if (!args || !args[0] || strchr(args, '=')) {
if (!args || !args[0] || ap_strchr_c(args, '=')) {
numwords = 1;
}
else {

View File

@@ -787,7 +787,7 @@ static char *find_desc(autoindex_config_rec *dcfg, request_rec *r)
* If the filename includes a path, extract just the name itself
* for the simple matches.
*/
if ((filename_only = strrchr(filename_full, '/')) == NULL) {
if ((filename_only = ap_strrchr_c(filename_full, '/')) == NULL) {
filename_only = filename_full;
}
else {

View File

@@ -1152,7 +1152,7 @@ static const char *set_error_document(cmd_parms *cmd, void *conf_,
}
/* Heuristic to determine second argument. */
if (strchr(msg,' '))
if (ap_strchr_c(msg,' '))
what = MSG;
else if (msg[0] == '/')
what = LOCAL_PATH;

View File

@@ -210,7 +210,7 @@ API_EXPORT(int) ap_set_byterange(request_rec *r)
return 0;
}
if (!strchr(range, ',')) {
if (!ap_strchr_c(range, ',')) {
/* A single range */
if (!parse_byterange(ap_pstrdup(r->pool, range + 6), r->clength,
&range_start, &range_end))

View File

@@ -865,7 +865,7 @@ API_EXPORT(request_rec *) ap_sub_req_lookup_file(const char *new_file,
* not even have to redo access checks.
*/
if (strchr(new_file, '/') == NULL) {
if (ap_strchr_c(new_file, '/') == NULL) {
char *udir = ap_make_dirstr_parent(rnew->pool, r->uri);
rnew->uri = ap_make_full_path(rnew->pool, udir, new_file);

View File

@@ -243,7 +243,7 @@ int unixd_setup_child(void)
}
const char *unixd_set_user(cmd_parms *cmd, void *dummy, char *arg)
const char *unixd_set_user(cmd_parms *cmd, void *dummy, const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -269,7 +269,7 @@ const char *unixd_set_user(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
const char *unixd_set_group(cmd_parms *cmd, void *dummy, char *arg)
const char *unixd_set_group(cmd_parms *cmd, void *dummy, const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {

View File

@@ -86,8 +86,8 @@ extern unixd_config_rec unixd_config;
void unixd_detach(void);
int unixd_setup_child(void);
void unixd_pre_config(void);
const char *unixd_set_user(cmd_parms *cmd, void *dummy, char *arg);
const char *unixd_set_group(cmd_parms *cmd, void *dummy, char *arg);
const char *unixd_set_user(cmd_parms *cmd, void *dummy, const char *arg);
const char *unixd_set_group(cmd_parms *cmd, void *dummy, const char *arg);
#if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || \
defined(RLIMIT_NPROC) || defined(RLIMIT_AS)
API_EXPORT(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit,
@@ -126,9 +126,9 @@ void unixd_siglist_init(void);
#endif /* HAVE_KILLPG */
#define UNIX_DAEMON_COMMANDS \
{ "User", unixd_set_user, NULL, RSRC_CONF, TAKE1, \
"Effective user id for this server"}, \
{ "Group", unixd_set_group, NULL, RSRC_CONF, TAKE1, \
"Effective group id for this server"}, \
AP_INIT_TAKE1("User", unixd_set_user, NULL, RSRC_CONF, \
"Effective user id for this server"), \
AP_INIT_TAKE1("Group", unixd_set_group, NULL, RSRC_CONF, \
"Effective group id for this server"),
#endif

View File

@@ -8,7 +8,7 @@ LTLIBRARY_SOURCES = \
http_protocol.c http_request.c http_vhost.c util.c util_date.c \
util_script.c util_uri.c util_md5.c util_cfgtree.c util_ebcdic.c \
rfc1413.c http_connection.c iol_file.c listen.c mpm_common.c \
util_charset.c
util_charset.c util_debug.c
include $(top_srcdir)/build/ltlib.mk
@@ -16,7 +16,7 @@ gen_uri_delims_OBJECTS = gen_uri_delims.lo
gen_uri_delims: $(gen_uri_delims_OBJECTS)
$(LINK) $(EXTRA_LDFLAGS) $(gen_uri_delims_OBJECTS)
gen_test_char_OBJECTS = gen_test_char.lo
gen_test_char_OBJECTS = gen_test_char.lo util_debug.lo
gen_test_char: $(gen_test_char_OBJECTS)
$(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS)

View File

@@ -277,13 +277,13 @@ static void init_handlers(ap_pool_t *p)
int nwildhandlers = 0;
const handler_rec *handp;
fast_handler_rec *ph, *pw;
char *starp;
const char *starp;
for (modp = top_module; modp; modp = modp->next) {
if (!modp->handlers)
continue;
for (handp = modp->handlers; handp->content_type; ++handp) {
if (strchr(handp->content_type, '*')) {
if (ap_strchr_c(handp->content_type, '*')) {
nwildhandlers ++;
} else {
nhandlers ++;
@@ -296,7 +296,7 @@ static void init_handlers(ap_pool_t *p)
if (!modp->handlers)
continue;
for (handp = modp->handlers; handp->content_type; ++handp) {
if ((starp = strchr(handp->content_type, '*'))) {
if ((starp = ap_strchr_c(handp->content_type, '*'))) {
pw->hr.content_type = handp->content_type;
pw->hr.handler = handp->handler;
pw->len = starp - handp->content_type;
@@ -319,7 +319,7 @@ int ap_invoke_handler(request_rec *r)
{
fast_handler_rec *handp;
const char *handler;
char *p;
const char *p;
size_t handler_len;
int result = HTTP_INTERNAL_SERVER_ERROR;
@@ -329,7 +329,8 @@ int ap_invoke_handler(request_rec *r)
}
else {
handler = r->content_type ? r->content_type : ap_default_type(r);
if ((p = strchr(handler, ';')) != NULL) { /* MIME type arguments */
if ((p = ap_strchr_c(handler, ';')) != NULL) {
/* MIME type arguments */
while (p > handler && p[-1] == ' ')
--p; /* strip trailing spaces */
handler_len = p - handler;

View File

@@ -250,8 +250,9 @@ void ap_listen_pre_config(void)
}
const char *ap_set_listener(cmd_parms *cmd, void *dummy, char *ips)
const char *ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips_)
{
char *ips=ap_pstrdup(cmd->pool, ips_);
char *ports;
unsigned short port;
@@ -290,7 +291,7 @@ const char *ap_set_listener(cmd_parms *cmd, void *dummy, char *ips)
return NULL;
}
const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg)
const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg)
{
int b;
@@ -307,7 +308,7 @@ const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, char *arg)
const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, const char *arg)
{
int s = atoi(arg);
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);

View File

@@ -93,8 +93,8 @@
int ap_threads_per_child=0; /* Worker threads per child */
int ap_max_requests_per_child=0;
static char *ap_pid_fname=NULL;
API_VAR_EXPORT char *ap_scoreboard_fname=NULL;
static const char *ap_pid_fname=NULL;
API_VAR_EXPORT const char *ap_scoreboard_fname=NULL;
static int ap_daemons_to_start=0;
static int min_spare_threads=0;
static int max_spare_threads=0;
@@ -159,7 +159,7 @@ static pthread_mutex_t worker_thread_count_mutex;
/* Locks for accept serialization */
static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER;
static ap_lock_t *process_accept_mutex;
static char *lock_fname;
static const char *lock_fname;
#ifdef NO_SERIALIZED_ACCEPT
#define SAFE_ACCEPT(stmt) APR_SUCCESS
@@ -1291,7 +1291,7 @@ static void mpmt_pthread_hooks(void)
}
static const char *set_pidfile(cmd_parms *cmd, void *dummy, char *arg)
static const char *set_pidfile(cmd_parms *cmd, void *dummy, const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1305,7 +1305,8 @@ static const char *set_pidfile(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
static const char *set_scoreboard(cmd_parms *cmd, void *dummy, char *arg)
static const char *set_scoreboard(cmd_parms *cmd, void *dummy,
const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1316,7 +1317,7 @@ static const char *set_scoreboard(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
static const char *set_lockfile(cmd_parms *cmd, void *dummy, char *arg)
static const char *set_lockfile(cmd_parms *cmd, void *dummy, const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1327,7 +1328,8 @@ static const char *set_lockfile(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, char *arg)
static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy,
const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1338,7 +1340,8 @@ static const char *set_daemons_to_start(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy, char *arg)
static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy,
const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1359,7 +1362,8 @@ static const char *set_min_spare_threads(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy, char *arg)
static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy,
const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1370,7 +1374,8 @@ static const char *set_max_spare_threads(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
static const char *set_server_limit (cmd_parms *cmd, void *dummy, char *arg)
static const char *set_server_limit (cmd_parms *cmd, void *dummy,
const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1396,7 +1401,8 @@ static const char *set_server_limit (cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg)
static const char *set_threads_per_child (cmd_parms *cmd, void *dummy,
const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1423,7 +1429,8 @@ static const char *set_threads_per_child (cmd_parms *cmd, void *dummy, char *arg
return NULL;
}
static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg)
static const char *set_max_requests(cmd_parms *cmd, void *dummy,
const char *arg)
{
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
if (err != NULL) {
@@ -1435,7 +1442,8 @@ static const char *set_max_requests(cmd_parms *cmd, void *dummy, char *arg)
return NULL;
}
static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg)
static const char *set_coredumpdir (cmd_parms *cmd, void *dummy,
const char *arg)
{
ap_finfo_t finfo;
const char *fname;
@@ -1457,26 +1465,26 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg)
static const command_rec mpmt_pthread_cmds[] = {
UNIX_DAEMON_COMMANDS
LISTEN_COMMANDS
{ "PidFile", set_pidfile, NULL, RSRC_CONF, TAKE1,
"A file for logging the server process ID"},
{ "ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, TAKE1,
"A file for Apache to maintain runtime process management information"},
{ "LockFile", set_lockfile, NULL, RSRC_CONF, TAKE1,
"The lockfile used when Apache needs to lock the accept() call"},
{ "StartServers", set_daemons_to_start, NULL, RSRC_CONF, TAKE1,
"Number of child processes launched at server startup" },
{ "MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF, TAKE1,
"Minimum number of idle children, to handle request spikes" },
{ "MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF, TAKE1,
"Maximum number of idle children" },
{ "MaxClients", set_server_limit, NULL, RSRC_CONF, TAKE1,
"Maximum number of children alive at the same time" },
{ "ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF, TAKE1,
"Number of threads each child creates" },
{ "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1,
"Maximum number of requests a particular child serves before dying." },
{ "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1,
"The location of the directory Apache changes to before dumping core" },
AP_INIT_TAKE1("PidFile", set_pidfile, NULL, RSRC_CONF,
"A file for logging the server process ID"),
AP_INIT_TAKE1("ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF,
"A file for Apache to maintain runtime process management information"),
AP_INIT_TAKE1("LockFile", set_lockfile, NULL, RSRC_CONF,
"The lockfile used when Apache needs to lock the accept() call"),
AP_INIT_TAKE1("StartServers", set_daemons_to_start, NULL, RSRC_CONF,
"Number of child processes launched at server startup"),
AP_INIT_TAKE1("MinSpareThreads", set_min_spare_threads, NULL, RSRC_CONF,
"Minimum number of idle children, to handle request spikes"),
AP_INIT_TAKE1("MaxSpareThreads", set_max_spare_threads, NULL, RSRC_CONF,
"Maximum number of idle children"),
AP_INIT_TAKE1("MaxClients", set_server_limit, NULL, RSRC_CONF,
"Maximum number of children alive at the same time"),
AP_INIT_TAKE1("ThreadsPerChild", set_threads_per_child, NULL, RSRC_CONF,
"Number of threads each child creates"),
AP_INIT_TAKE1("MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF,
"Maximum number of requests a particular child serves before dying."),
AP_INIT_TAKE1("CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF,
"The location of the directory Apache changes to before dumping core"),
{ NULL }
};

View File

@@ -128,7 +128,7 @@ API_EXPORT(char *) ap_field_noparam(ap_pool_t *p, const char *intype)
if (intype == NULL) return NULL;
semi = strchr(intype, ';');
semi = ap_strchr_c(intype, ';');
if (semi == NULL) {
return ap_pstrdup(p, intype);
}
@@ -628,7 +628,7 @@ API_EXPORT(char *) ap_getword_nc(ap_pool_t *atrans, char **line, char stop)
API_EXPORT(char *) ap_getword(ap_pool_t *atrans, const char **line, char stop)
{
char *pos = strchr(*line, stop);
const char *pos = ap_strchr_c(*line, stop);
char *res;
if (!pos) {
@@ -689,7 +689,7 @@ API_EXPORT(char *) ap_getword_nulls_nc(ap_pool_t *atrans, char **line, char stop
API_EXPORT(char *) ap_getword_nulls(ap_pool_t *atrans, const char **line, char stop)
{
char *pos = strchr(*line, stop);
const char *pos = ap_strchr_c(*line, stop);
char *res;
if (!pos) {
@@ -785,27 +785,27 @@ API_EXPORT(char *) ap_getword_conf(ap_pool_t *p, const char **line)
* environment value does not exist, leave the ${ENV}
* construct alone; it means something else.
*/
API_EXPORT(char *) ap_resolve_env(ap_pool_t *p, const char * word)
API_EXPORT(const char *) ap_resolve_env(ap_pool_t *p, const char * word)
{
char tmp[ MAX_STRING_LEN ];
char * s, * e;
const char *s, *e;
tmp[0] = '\0';
if (!(s=strchr(word,'$')))
return (char *)word;
if (!(s=ap_strchr_c(word,'$')))
return word;
do {
/* XXX - relies on strncat() to add '\0'
*/
strncat(tmp,word,s - word);
if ((s[1] == '{') && (e=strchr(s,'}'))) {
*e = '\0';
if ((s[1] == '{') && (e=ap_strchr_c(s,'}'))) {
const char *e2 = e;
word = e + 1;
e = getenv(s+2);
if (e) {
strcat(tmp,e);
} else {
strcat(tmp,s);
strncat(tmp, s, e2-s);
strcat(tmp,"}");
}
} else {
@@ -813,7 +813,7 @@ API_EXPORT(char *) ap_resolve_env(ap_pool_t *p, const char * word)
word = s+1;
strcat(tmp,"$");
};
} while ((s=strchr(word,'$')));
} while ((s=ap_strchr_c(word,'$')));
strcat(tmp,word);
return ap_pstrdup(p,tmp);
@@ -1605,8 +1605,8 @@ API_EXPORT(char *) ap_os_escape_path(ap_pool_t *p, const char *path, int partial
unsigned c;
if (!partial) {
char *colon = strchr(path, ':');
char *slash = strchr(path, '/');
const char *colon = ap_strchr_c(path, ':');
const char *slash = ap_strchr_c(path, '/');
if (colon && (!slash || colon < slash)) {
*d++ = '.';
@@ -2016,14 +2016,3 @@ API_EXPORT(char *) ap_escape_quotes (ap_pool_t *p, const char *instring)
*outchr = '\0';
return outstring;
}
#ifdef AP_DEBUG
# 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); }
#endif

78
server/util_debug.c Normal file
View File

@@ -0,0 +1,78 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* Portions of this software are based upon public domain software
* originally written at the National Center for Supercomputing Applications,
* University of Illinois, Urbana-Champaign.
*/
#include "httpd.h"
#ifdef AP_DEBUG
# undef strchr
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); }
#endif

View File

@@ -484,7 +484,7 @@ deal_with_path:
}
if (*s == '?') {
++s;
s1 = strchr(s, '#');
s1 = ap_strchr_c(s, '#');
if (s1) {
uptr->fragment = ap_pstrdup(p, s1 + 1);
uptr->query = ap_pstrndup(p, s, s1 - s);
@@ -588,7 +588,7 @@ API_EXPORT(int) ap_parse_hostinfo_components(ap_pool_t *p, const char *hostinfo,
/* We expect hostinfo to point to the first character of
* the hostname. There must be a port, separated by a colon
*/
s = strchr(hostinfo, ':');
s = ap_strchr_c(hostinfo, ':');
if (s == NULL) {
return HTTP_BAD_REQUEST;
}

View File

@@ -179,7 +179,7 @@ void ap_init_vhost_config(ap_pool_t *p)
* *paddr is the variable used to keep track of **paddr between calls
* port is the default port to assume
*/
static const char *get_addresses(ap_pool_t *p, const char *w,
static const char *get_addresses(ap_pool_t *p, const char *w_,
server_addr_rec ***paddr, unsigned port)
{
struct hostent *hep;
@@ -187,10 +187,12 @@ static const char *get_addresses(ap_pool_t *p, const char *w,
server_addr_rec *sar;
char *t;
int i, is_an_ip_addr;
char *w;
if (*w == 0)
if (*w_ == 0)
return NULL;
w=ap_pstrdup(p, w_);
t = strchr(w, ':');
if (t) {
if (strcmp(t + 1, "*") == 0) {
@@ -225,8 +227,6 @@ static const char *get_addresses(ap_pool_t *p, const char *w,
sar->host_addr.s_addr = my_addr;
sar->host_port = port;
sar->virthost = ap_pstrdup(p, w);
if (t != NULL)
*t = ':';
return NULL;
}
@@ -235,8 +235,6 @@ static const char *get_addresses(ap_pool_t *p, const char *w,
if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL,
"Cannot resolve host name %s --- ignoring!", w);
if (t != NULL)
*t = ':';
return NULL;
}
@@ -249,8 +247,6 @@ static const char *get_addresses(ap_pool_t *p, const char *w,
sar->virthost = ap_pstrdup(p, w);
}
if (t != NULL)
*t = ':';
return NULL;
}