apr_int64_t h2_config_geti64(const h2_config *conf, h2_config_var_t var) { switch(var) { case H2_CONF_MAX_STREAMS: return H2_CONFIG_GET(conf, &defconf, h2_max_streams); case H2_CONF_WIN_SIZE: return H2_CONFIG_GET(conf, &defconf, h2_window_size); case H2_CONF_MIN_WORKERS: return H2_CONFIG_GET(conf, &defconf, min_workers); case H2_CONF_MAX_WORKERS: return H2_CONFIG_GET(conf, &defconf, max_workers); case H2_CONF_MAX_WORKER_IDLE_SECS: return H2_CONFIG_GET(conf, &defconf, max_worker_idle_secs); case H2_CONF_STREAM_MAX_MEM: return H2_CONFIG_GET(conf, &defconf, stream_max_mem_size); case H2_CONF_ALT_SVC_MAX_AGE: return H2_CONFIG_GET(conf, &defconf, alt_svc_max_age); case H2_CONF_SER_HEADERS: return H2_CONFIG_GET(conf, &defconf, serialize_headers); case H2_CONF_MODERN_TLS_ONLY: return H2_CONFIG_GET(conf, &defconf, modern_tls_only); case H2_CONF_UPGRADE: return H2_CONFIG_GET(conf, &defconf, h2_upgrade); case H2_CONF_DIRECT: return H2_CONFIG_GET(conf, &defconf, h2_direct); case H2_CONF_TLS_WARMUP_SIZE: return H2_CONFIG_GET(conf, &defconf, tls_warmup_size); case H2_CONF_TLS_COOLDOWN_SECS: return H2_CONFIG_GET(conf, &defconf, tls_cooldown_secs); case H2_CONF_PUSH: return H2_CONFIG_GET(conf, &defconf, h2_push); case H2_CONF_PUSH_DIARY_SIZE: return H2_CONFIG_GET(conf, &defconf, push_diary_size); case H2_CONF_COPY_FILES: return H2_CONFIG_GET(conf, &defconf, copy_files); case H2_CONF_EARLY_HINTS: return H2_CONFIG_GET(conf, &defconf, early_hints); default: return DEF_VAL; } }
static void *h2_config_merge(apr_pool_t *pool, void *basev, void *addv) { h2_config *base = (h2_config *)basev; h2_config *add = (h2_config *)addv; h2_config *n = (h2_config *)apr_pcalloc(pool, sizeof(h2_config)); char *name = apr_pstrcat(pool, "merged[", add->name, ", ", base->name, "]", NULL); n->name = name; n->h2_max_streams = H2_CONFIG_GET(add, base, h2_max_streams); n->h2_window_size = H2_CONFIG_GET(add, base, h2_window_size); n->min_workers = H2_CONFIG_GET(add, base, min_workers); n->max_workers = H2_CONFIG_GET(add, base, max_workers); n->max_worker_idle_secs = H2_CONFIG_GET(add, base, max_worker_idle_secs); n->stream_max_mem_size = H2_CONFIG_GET(add, base, stream_max_mem_size); n->alt_svcs = add->alt_svcs? add->alt_svcs : base->alt_svcs; n->alt_svc_max_age = H2_CONFIG_GET(add, base, alt_svc_max_age); n->serialize_headers = H2_CONFIG_GET(add, base, serialize_headers); n->h2_direct = H2_CONFIG_GET(add, base, h2_direct); n->modern_tls_only = H2_CONFIG_GET(add, base, modern_tls_only); n->h2_upgrade = H2_CONFIG_GET(add, base, h2_upgrade); n->tls_warmup_size = H2_CONFIG_GET(add, base, tls_warmup_size); n->tls_cooldown_secs = H2_CONFIG_GET(add, base, tls_cooldown_secs); n->h2_push = H2_CONFIG_GET(add, base, h2_push); if (add->priorities && base->priorities) { n->priorities = apr_hash_overlay(pool, add->priorities, base->priorities); } else { n->priorities = add->priorities? add->priorities : base->priorities; } n->push_diary_size = H2_CONFIG_GET(add, base, push_diary_size); n->copy_files = H2_CONFIG_GET(add, base, copy_files); if (add->push_list && base->push_list) { n->push_list = apr_array_append(pool, base->push_list, add->push_list); } else { n->push_list = add->push_list? add->push_list : base->push_list; } n->early_hints = H2_CONFIG_GET(add, base, early_hints); return n; }
void *h2_config_merge(apr_pool_t *pool, void *basev, void *addv) { h2_config *base = (h2_config *)basev; h2_config *add = (h2_config *)addv; h2_config *n = (h2_config *)apr_pcalloc(pool, sizeof(h2_config)); char *name = (char *)apr_pcalloc(pool, 20 + strlen(add->name) + strlen(base->name)); strcpy(name, "merged["); strcat(name, add->name); strcat(name, ", "); strcat(name, base->name); strcat(name, "]"); n->name = name; n->h2_enabled = H2_CONFIG_GET(add, base, h2_enabled); n->h2_max_streams = H2_CONFIG_GET(add, base, h2_max_streams); n->h2_max_hl_size = H2_CONFIG_GET(add, base, h2_max_hl_size); n->h2_window_size = H2_CONFIG_GET(add, base, h2_window_size); n->min_workers = H2_CONFIG_GET(add, base, min_workers); n->max_workers = H2_CONFIG_GET(add, base, max_workers); n->max_worker_idle_secs = H2_CONFIG_GET(add, base, max_worker_idle_secs); n->stream_max_mem_size = H2_CONFIG_GET(add, base, stream_max_mem_size); n->alt_svcs = add->alt_svcs? add->alt_svcs : base->alt_svcs; n->alt_svc_max_age = H2_CONFIG_GET(add, base, alt_svc_max_age); n->serialize_headers = H2_CONFIG_GET(add, base, serialize_headers); n->hack_mpm_event = H2_CONFIG_GET(add, base, hack_mpm_event); n->h2_direct = H2_CONFIG_GET(add, base, h2_direct); return n; }
int h2_config_geti(h2_config *conf, h2_config_var_t var) { switch(var) { case H2_CONF_ENABLED: return H2_CONFIG_GET(conf, &defconf, h2_enabled); case H2_CONF_MAX_STREAMS: return H2_CONFIG_GET(conf, &defconf, h2_max_streams); case H2_CONF_MAX_HL_SIZE: return H2_CONFIG_GET(conf, &defconf, h2_max_hl_size); case H2_CONF_WIN_SIZE: return H2_CONFIG_GET(conf, &defconf, h2_window_size); case H2_CONF_MIN_WORKERS: return H2_CONFIG_GET(conf, &defconf, min_workers); case H2_CONF_MAX_WORKERS: return H2_CONFIG_GET(conf, &defconf, max_workers); case H2_CONF_MAX_WORKER_IDLE_SECS: return H2_CONFIG_GET(conf, &defconf, max_worker_idle_secs); case H2_CONF_STREAM_MAX_MEM: return H2_CONFIG_GET(conf, &defconf, stream_max_mem_size); case H2_CONF_ALT_SVC_MAX_AGE: return H2_CONFIG_GET(conf, &defconf, alt_svc_max_age); case H2_CONF_SER_HEADERS: return H2_CONFIG_GET(conf, &defconf, serialize_headers); case H2_CONF_HACK_MPM_EVENT: return H2_CONFIG_GET(conf, &defconf, hack_mpm_event); case H2_CONF_DIRECT: return H2_CONFIG_GET(conf, &defconf, h2_direct); default: return DEF_VAL; } }
apr_int64_t h2_config_geti64(h2_config *conf, h2_config_var_t var) { int n; switch(var) { case H2_CONF_MAX_STREAMS: return H2_CONFIG_GET(conf, &defconf, h2_max_streams); case H2_CONF_WIN_SIZE: return H2_CONFIG_GET(conf, &defconf, h2_window_size); case H2_CONF_MIN_WORKERS: return H2_CONFIG_GET(conf, &defconf, min_workers); case H2_CONF_MAX_WORKERS: return H2_CONFIG_GET(conf, &defconf, max_workers); case H2_CONF_MAX_WORKER_IDLE_SECS: return H2_CONFIG_GET(conf, &defconf, max_worker_idle_secs); case H2_CONF_STREAM_MAX_MEM: return H2_CONFIG_GET(conf, &defconf, stream_max_mem_size); case H2_CONF_ALT_SVC_MAX_AGE: return H2_CONFIG_GET(conf, &defconf, alt_svc_max_age); case H2_CONF_SER_HEADERS: return H2_CONFIG_GET(conf, &defconf, serialize_headers); case H2_CONF_MODERN_TLS_ONLY: return H2_CONFIG_GET(conf, &defconf, modern_tls_only); case H2_CONF_UPGRADE: return H2_CONFIG_GET(conf, &defconf, h2_upgrade); case H2_CONF_DIRECT: return H2_CONFIG_GET(conf, &defconf, h2_direct); case H2_CONF_SESSION_FILES: n = H2_CONFIG_GET(conf, &defconf, session_extra_files); if (n < 0) { n = files_per_session; } return n; case H2_CONF_TLS_WARMUP_SIZE: return H2_CONFIG_GET(conf, &defconf, tls_warmup_size); case H2_CONF_TLS_COOLDOWN_SECS: return H2_CONFIG_GET(conf, &defconf, tls_cooldown_secs); default: return DEF_VAL; } }
void *h2_config_merge(apr_pool_t *pool, void *basev, void *addv) { h2_config *base = (h2_config *)basev; h2_config *add = (h2_config *)addv; h2_config *n = (h2_config *)apr_pcalloc(pool, sizeof(h2_config)); char *name = apr_pcalloc(pool, 20 + strlen(add->name) + strlen(base->name)); strcpy(name, "merged["); strcat(name, add->name); strcat(name, ", "); strcat(name, base->name); strcat(name, "]"); n->name = name; n->h2_max_streams = H2_CONFIG_GET(add, base, h2_max_streams); n->h2_window_size = H2_CONFIG_GET(add, base, h2_window_size); n->min_workers = H2_CONFIG_GET(add, base, min_workers); n->max_workers = H2_CONFIG_GET(add, base, max_workers); n->max_worker_idle_secs = H2_CONFIG_GET(add, base, max_worker_idle_secs); n->stream_max_mem_size = H2_CONFIG_GET(add, base, stream_max_mem_size); n->alt_svcs = add->alt_svcs? add->alt_svcs : base->alt_svcs; n->alt_svc_max_age = H2_CONFIG_GET(add, base, alt_svc_max_age); n->serialize_headers = H2_CONFIG_GET(add, base, serialize_headers); n->h2_direct = H2_CONFIG_GET(add, base, h2_direct); n->session_extra_files = H2_CONFIG_GET(add, base, session_extra_files); n->modern_tls_only = H2_CONFIG_GET(add, base, modern_tls_only); n->h2_upgrade = H2_CONFIG_GET(add, base, h2_upgrade); n->tls_warmup_size = H2_CONFIG_GET(add, base, tls_warmup_size); n->tls_cooldown_secs = H2_CONFIG_GET(add, base, tls_cooldown_secs); return n; }