/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
*/
/* WARNING: Win32 binds http_main.c dynamically to the server. Please place * extern functions and global data in another appropriate module. * * Most significant main() global data can be found in http_config.c
*/
staticvoid show_mpm_settings(void)
{ int mpm_query_info;
apr_status_t retval;
staticvoid destroy_and_exit_process(process_rec *process, int process_exit_value)
{ /* * Sleep for TASK_SWITCH_SLEEP micro seconds to cause a task switch on * OS layer and thus give possibly started piped loggers a chance to * process their input. Otherwise it is possible that they get killed * by us before they can do so. In this case maybe valuable log messages * might get lost.
*/
apr_sleep(TASK_SWITCH_SLEEP);
ap_main_state = AP_SQ_MS_EXITING;
apr_pool_destroy(process->pool); /* and destroy all descendent pools */
apr_terminate(); exit(process_exit_value);
}
/* Deregister all hooks when clearing pconf (pre_cleanup). * TODO: have a hook to deregister and run them from here? * ap_clear_auth_internal() is already a candidate.
*/ static apr_status_t deregister_all_hooks(void *unused)
{
(void)unused;
ap_clear_auth_internal();
apr_hook_deregister_all(); return APR_SUCCESS;
}
stat = apr_app_initialize(argc, argv, NULL); if (stat == APR_SUCCESS) {
failed = "apr_pool_create()";
stat = apr_pool_create(&cntx, NULL);
}
if (stat != APR_SUCCESS) { /* For all intents and purposes, this is impossibly unlikely, * but APR doesn't exist yet, we can't use it for reporting * these earliest two failures; * * XXX: Note the apr_ctime() and apr_time_now() calls. These * work, today, against an uninitialized APR, but in the future * (if they relied on global pools or mutexes, for example) then * the datestamp logic will need to be replaced.
*/ char ctimebuff[APR_CTIME_LEN];
apr_ctime(ctimebuff, apr_time_now());
fprintf(stderr, "[%s] [crit] (%d) %s: %s failed " "to initial context, exiting\n",
ctimebuff, stat, (*argv)[0], failed);
apr_terminate(); exit(1);
}
/* Set up the OOM callback in the global pool, so all pools should
* by default inherit it. */
apr_pool_abort_set(abort_on_oom, apr_pool_parent_get(process->pool));
/* Maintain AP_SERVER_BASEARGS list in http_main.h to allow the MPM * to safely pass on our args from its rewrite_args() handler.
*/
apr_getopt_init(&opt, pcommands, process->argc, process->argv);
/* Note that we preflight the config file once * before reading it _again_ in the main loop. * This allows things, log files configuration * for example, to settle down.
*/
ap_server_root = def_server_root; if (temp_error_log) {
ap_replace_stderr_log(process->pool, temp_error_log);
}
ap_server_conf = NULL; /* set early by ap_read_config() for logging */ if (!ap_read_config(process, ptemp, confname, &ap_conftree)) { if (showcompile) { /* Well, we tried. Show as much as we can, but exit nonzero to * indicate that something's not right. The cause should have
* already been logged. */
show_compile_settings();
}
destroy_and_exit_process(process, 1);
}
ap_assert(ap_server_conf != NULL);
apr_pool_cleanup_register(pconf, &ap_server_conf, ap_pool_cleanup_set_null,
apr_pool_cleanup_null);
if (showcompile) { /* deferred due to dynamically loaded MPM */
show_compile_settings();
destroy_and_exit_process(process, 0);
}
/* sort hooks here to make sure pre_config hooks are sorted properly */
apr_hook_sort_all();
rv = ap_process_config_tree(ap_server_conf, ap_conftree,
process->pconf, ptemp); if (rv == OK) {
ap_fixup_virtual_hosts(pconf, ap_server_conf);
ap_fini_vhost_config(pconf, ap_server_conf); /* * Sort hooks again because ap_process_config_tree may have add modules * and hence hooks. This happens with mod_perl and modules written in * perl.
*/
apr_hook_sort_all();
/* This is a hack until we finish the code so that it only reads * the config file once and just operates on the tree already in * memory. rbb
*/
ap_conftree = NULL;
apr_pool_create(&ptemp, pconf);
apr_pool_tag(ptemp, "ptemp");
ap_server_root = def_server_root;
ap_server_conf = NULL; /* set early by ap_read_config() for logging */ if (!ap_read_config(process, ptemp, confname, &ap_conftree)) {
destroy_and_exit_process(process, 1);
}
ap_assert(ap_server_conf != NULL);
apr_pool_cleanup_register(pconf, &ap_server_conf,
ap_pool_cleanup_set_null, apr_pool_cleanup_null); /* sort hooks here to make sure pre_config hooks are sorted properly */
apr_hook_sort_all();
if (ap_process_config_tree(ap_server_conf, ap_conftree, process->pconf,
ptemp) != OK) {
destroy_and_exit_process(process, 1);
}
ap_fixup_virtual_hosts(pconf, ap_server_conf);
ap_fini_vhost_config(pconf, ap_server_conf); /* * Sort hooks again because ap_process_config_tree may have add modules * and hence hooks. This happens with mod_perl and modules written in * perl.
*/
apr_hook_sort_all();
#ifdef AP_USING_AUTOCONF /* This ugly little hack pulls any function referenced in exports.c into * the web server. exports.c is generated during the build, and it * has all of the APR functions specified by the apr/apr.exports and * apr-util/aprutil.exports files.
*/ constvoid *ap_suck_in_APR(void); constvoid *ap_suck_in_APR(void)
{ externconstvoid *ap_ugly_hack;
return ap_ugly_hack;
} #endif
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.19Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.