/* 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.
*/
AP_DECLARE_MODULE(http2) = {
STANDARD20_MODULE_STUFF,
h2_config_create_dir, /* func to create per dir config */
h2_config_merge_dir, /* func to merge per dir config */
h2_config_create_svr, /* func to create per server config */
h2_config_merge_svr, /* func to merge per server config */
h2_cmds, /* command handlers */
h2_hooks, #ifdefined(AP_MODULE_FLAG_NONE)
AP_MODULE_FLAG_ALWAYS_MERGE #endif
};
/* The module initialization. Called once as apache hook, before any multi * processing (threaded or not) happens. It is typically at least called twice, * see * http://wiki.apache.org/httpd/ModuleLife * Since the first run is just a "practise" run, we want to initialize for real * only on the second try. This defeats the purpose of the first dry run a bit, * since apache wants to verify that a new configuration actually will work. * So if we have trouble with the configuration, this will only be detected * when the server has already switched. * On the other hand, when we initialize lib nghttp2, all possible crazy things * might happen and this might even eat threads. So, better init on the real * invocation, for now at least.
*/ staticint h2_post_config(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{ void *data = NULL; constchar *mod_h2_init_key = "mod_http2_init_counter";
nghttp2_info *ngh2;
apr_status_t status;
if (!h2_mpm_supported() && !mpm_warned) {
mpm_warned = 1;
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, s, APLOGNO(10034) "The mpm module (%s) is not supported by mod_http2. The mpm determines " "how things are processed in your server. HTTP/2 has more demands in " "this regard and the currently selected mpm will just not do. " "This is an advisory warning. Your server will continue to work, but " "the HTTP/2 protocol will be inactive.",
h2_conn_mpm_name());
}
status = h2_protocol_init(p, s); if (status == APR_SUCCESS) {
status = h2_switch_init(p, s);
}
staticvoid http2_get_num_workers(server_rec *s, int *minw, int *maxw)
{
apr_time_t tdummy;
h2_get_workers_config(s, minw, maxw, &tdummy);
}
/* Runs once per created child process. Perform any process * related initionalization here.
*/ staticvoid h2_child_init(apr_pool_t *pchild, server_rec *s)
{
apr_status_t rv;
/* Set up our connection processing */
rv = h2_c1_child_init(pchild, s); if (APR_SUCCESS == rv) {
rv = h2_c2_child_init(pchild, s);
} if (APR_SUCCESS != rv) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
APLOGNO(02949) "initializing connection handling");
}
}
/* Install this module into the apache2 infrastructure.
*/ staticvoid h2_hooks(apr_pool_t *pool)
{ staticconstchar *const mod_ssl[] = { "mod_ssl.c", NULL};
ap_log_perror(APLOG_MARK, APLOG_TRACE1, 0, pool, "installing hooks");
/* Run once after configuration is set, but before mpm children initialize.
*/
ap_hook_post_config(h2_post_config, mod_ssl, NULL, APR_HOOK_MIDDLE);
/* Run once after a child process has been created.
*/
ap_hook_child_init(h2_child_init, NULL, NULL, APR_HOOK_MIDDLE); #if AP_MODULE_MAGIC_AT_LEAST(20120211, 110)
ap_hook_child_stopping(h2_c1_child_stopping, NULL, NULL, APR_HOOK_MIDDLE); #endif
staticchar *http2_var_lookup(apr_pool_t *p, server_rec *s,
conn_rec *c, request_rec *r, char *name)
{ unsignedint i; /* If the # of vars grow, we need to put definitions in a hash */ for (i = 0; i < H2_ALEN(H2_VARS); ++i) {
h2_var_def *vdef = &H2_VARS[i]; if (!strcmp(vdef->name, name)) {
h2_conn_ctx_t *ctx = (r? h2_conn_ctx_get(c) :
h2_conn_ctx_get(c->master? c->master : c)); return (char *)vdef->lookup(p, s, c, r, ctx);
}
} return (char*)"";
}
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.