Browse Source

[multiple] generic config array type checking

personal/stbuehler/ci-build
Glenn Strauss 2 years ago
parent
commit
03b4c993d2
  1. 56
      src/configfile-glue.c
  2. 38
      src/configfile.c
  3. 14
      src/gw_backend.c
  4. 25
      src/mod_access.c
  5. 9
      src/mod_alias.c
  6. 11
      src/mod_auth.c
  7. 2
      src/mod_authn_pam.c
  8. 2
      src/mod_authn_sasl.c
  9. 19
      src/mod_cgi.c
  10. 8
      src/mod_cml.c
  11. 16
      src/mod_compress.c
  12. 16
      src/mod_deflate.c
  13. 8
      src/mod_dirlisting.c
  14. 18
      src/mod_expire.c
  15. 26
      src/mod_extforward.c
  16. 12
      src/mod_fastcgi.c
  17. 22
      src/mod_flv_streaming.c
  18. 25
      src/mod_indexfile.c
  19. 10
      src/mod_magnet.c
  20. 2
      src/mod_maxminddb.c
  21. 8
      src/mod_openssl.c
  22. 30
      src/mod_proxy.c
  23. 9
      src/mod_redirect.c
  24. 40
      src/mod_rewrite.c
  25. 12
      src/mod_scgi.c
  26. 18
      src/mod_setenv.c
  27. 22
      src/mod_skeleton.c
  28. 2
      src/mod_sockproxy.c
  29. 27
      src/mod_ssi.c
  30. 22
      src/mod_staticfile.c
  31. 8
      src/mod_trigger_b4_dl.c
  32. 31
      src/mod_userdir.c
  33. 9
      src/mod_vhostdb_dbi.c
  34. 9
      src/mod_vhostdb_ldap.c
  35. 9
      src/mod_vhostdb_mysql.c
  36. 9
      src/mod_vhostdb_pgsql.c
  37. 2
      src/mod_webdav.c
  38. 21
      src/mod_wstunnel.c
  39. 4
      src/plugin_config.h

56
src/configfile-glue.c

@ -50,19 +50,65 @@ int config_plugin_values_init_block(server * const srv, const array * const ca,
switch (cpk[i].ktype) {
case T_CONFIG_ARRAY:
case T_CONFIG_ARRAY_KVANY:
case T_CONFIG_ARRAY_KVARRAY:
case T_CONFIG_ARRAY_KVSTRING:
case T_CONFIG_ARRAY_VLIST:
if (du->type == TYPE_ARRAY) {
cpv->v.a = &((const data_array *)du)->value;
/* future: might provide modifiers to perform one of
* array_is_{vlist,kvany,kvarray,kvstring}() tests
* and provide generic error message if mismatch */
}
else {
log_error(srv->errh, __FILE__, __LINE__,
"%s should have been an array of strings like "
"... = ( \"...\" )", cpk[i].k);
"%s should have been a list like "
"%s = ( \"...\" )", cpk[i].k, cpk[i].k);
rc = 0;
continue;
}
switch (cpk[i].ktype) {
case T_CONFIG_ARRAY_KVANY:
if (!array_is_kvany(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"%s should have been a list of key => values like "
"%s = ( \"...\" => \"...\", \"...\" => \"...\" )",
cpk[i].k, cpk[i].k);
rc = 0;
continue;
}
break;
case T_CONFIG_ARRAY_KVARRAY:
if (!array_is_kvarray(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"%s should have been a list of key => list like "
"%s = ( \"...\" => ( \"...\" => \"...\" ) )",
cpk[i].k, cpk[i].k);
rc = 0;
continue;
}
break;
case T_CONFIG_ARRAY_KVSTRING:
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"%s should have been a list of key => string values like "
"%s = ( \"...\" => \"...\", \"...\" => \"...\" )",
cpk[i].k, cpk[i].k);
rc = 0;
continue;
}
break;
case T_CONFIG_ARRAY_VLIST:
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"%s should have been a list of string values like "
"%s = ( \"...\", \"...\" )",
cpk[i].k, cpk[i].k);
rc = 0;
continue;
}
break;
/*case T_CONFIG_ARRAY:*/
default:
break;
}
break;
case T_CONFIG_STRING:
if (du->type == TYPE_STRING) {

38
src/configfile.c

@ -373,12 +373,6 @@ static int config_http_parseopts (server *srv, const array *a) {
unsigned short int opts = srv->srvconf.http_url_normalize;
unsigned short int decode_2f = 1;
int rc = 1;
if (!array_is_kvstring(a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for server.http-parseopts; "
"expected list of \"key\" => \"[enable|disable]\"");
return 0;
}
for (size_t i = 0; i < a->used; ++i) {
const data_string * const ds = (const data_string *)a->data[i];
const buffer *k = &ds->key;
@ -485,7 +479,7 @@ static int config_http_parseopts (server *srv, const array *a) {
static int config_insert_srvconf(server *srv) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("server.modules"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_SERVER }
,{ CONST_STR_LEN("server.compat-module-load"),
T_CONFIG_BOOL,
@ -551,10 +545,10 @@ static int config_insert_srvconf(server *srv) {
T_CONFIG_INT,
T_CONFIG_SCOPE_SERVER }
,{ CONST_STR_LEN("server.upload-dirs"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_SERVER }
,{ CONST_STR_LEN("server.http-parseopts"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_SERVER }
,{ CONST_STR_LEN("server.http-parseopt-header-strict"),
T_CONFIG_BOOL,
@ -603,14 +597,6 @@ static int config_insert_srvconf(server *srv) {
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* server.modules */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"mod_xxxxxx\" strings",
cpk[cpv->k_id].k);
rc = HANDLER_ERROR;
break;
}
array_copy_array(srv->srvconf.modules, cpv->v.a);
break;
case 1: /* server.compat-module-load */
@ -677,13 +663,6 @@ static int config_insert_srvconf(server *srv) {
srv->srvconf.upload_temp_file_size = cpv->v.u;
break;
case 22:/* server.upload-dirs */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"path\" strings", cpk[cpv->k_id].k);
rc = HANDLER_ERROR;
break;
}
array_copy_array(srv->srvconf.upload_tempdirs, cpv->v.a);
break;
case 23:/* server.http-parseopts */
@ -808,7 +787,7 @@ static int config_insert(server *srv) {
T_CONFIG_SHORT,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("mimetype.assign"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("mimetype.use-xattr"),
T_CONFIG_BOOL,
@ -922,16 +901,7 @@ static int config_insert(server *srv) {
break;
}
case 19:/* connection.kbytes-per-second */
break;
case 20:/* mimetype.assign */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"ext\" => \"mimetype\"",
cpk[cpv->k_id].k);
rc = HANDLER_ERROR;
}
break;
case 21:/* mimetype.use-xattr */
case 22:/* etag.use-inode */
case 23:/* etag.use-mtime */

14
src/gw_backend.c

@ -1234,10 +1234,10 @@ int gw_set_defaults_backend(server *srv, gw_plugin_data *p, const array *a, gw_p
T_CONFIG_SHORT,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("bin-environment"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("bin-copy-environment"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("broken-scriptfilename"),
T_CONFIG_BOOL,
@ -1255,7 +1255,7 @@ int gw_set_defaults_backend(server *srv, gw_plugin_data *p, const array *a, gw_p
T_CONFIG_BOOL,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("x-sendfile-docroot"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("tcp-fin-propagate"),
T_CONFIG_BOOL,
@ -1267,14 +1267,6 @@ int gw_set_defaults_backend(server *srv, gw_plugin_data *p, const array *a, gw_p
gw_host *host = NULL;
if (!array_is_kvarray(a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; expected "
"( \"ext\" => ( \"backend-label\" => ( \"key\" => \"value\" )))",
cpkkey);
return 0;
}
p->srv_pid = srv->pid;
s->exts = gw_extensions_init();

25
src/mod_access.c

@ -55,10 +55,10 @@ static void mod_access_patch_config(connection * const con, plugin_data * const
SETDEFAULTS_FUNC(mod_access_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("url.access-deny"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("url.access-allow"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -69,27 +69,6 @@ SETDEFAULTS_FUNC(mod_access_set_defaults) {
if (!config_plugin_values_init(srv, p, cpk, "mod_access"))
return HANDLER_ERROR;
/* process and validate config directives
* (init i to 0 if global context; to 1 to skip empty global context) */
for (int i = !p->cvlist[0].v.u2[1]; i < p->nconfig; ++i) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist[i].v.u2[0];
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* url.access-deny */
case 1: /* url.access-allow */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"suffix\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
default:/* should not happen */
break;
}
}
}
/* initialize p->defaults from global config context */
if (p->nconfig > 0 && p->cvlist->v.u2[1]) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist->v.u2[0];

9
src/mod_alias.c

@ -79,7 +79,7 @@ static int mod_alias_check_order(server * const srv, const array * const a) {
SETDEFAULTS_FUNC(mod_alias_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("alias.url"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -97,13 +97,6 @@ SETDEFAULTS_FUNC(mod_alias_set_defaults) {
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* alias.url */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"urlpath\" => \"filepath\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
if (cpv->v.a->used >= 2 && !mod_alias_check_order(srv,cpv->v.a))
return HANDLER_ERROR;
break;

11
src/mod_auth.c

@ -396,7 +396,7 @@ SETDEFAULTS_FUNC(mod_auth_set_defaults) {
T_CONFIG_STRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("auth.require"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVARRAY,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("auth.extern-authn"),
T_CONFIG_BOOL,
@ -430,7 +430,7 @@ SETDEFAULTS_FUNC(mod_auth_set_defaults) {
}
break;
case 1: /* auth.require */
if (array_is_kvarray(cpv->v.a)) {
{
array * const a = array_init(4);
if (HANDLER_GO_ON !=
mod_auth_require_parse_array(cpv->v.a, a, srv->errh)) {
@ -440,13 +440,6 @@ SETDEFAULTS_FUNC(mod_auth_set_defaults) {
cpv->v.a = a;
cpv->vtype = T_CONFIG_LOCAL;
}
else {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; expected "
"%s = ( \"urlpath\" => ( \"option\" => \"value\" ) )",
cpk[cpv->k_id].k, cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
case 2: /* auth.extern-authn */
break;

2
src/mod_authn_pam.c

@ -74,7 +74,7 @@ static void mod_authn_pam_patch_config(connection * const con, plugin_data * con
SETDEFAULTS_FUNC(mod_authn_pam_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("auth.backend.pam.opts"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,

2
src/mod_authn_sasl.c

@ -158,7 +158,7 @@ static plugin_config * mod_authn_sasl_parse_opts(server *srv, const array * cons
SETDEFAULTS_FUNC(mod_authn_sasl_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("auth.backend.sasl.opts"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,

19
src/mod_cgi.c

@ -189,7 +189,7 @@ static void mod_cgi_patch_config(connection * const con, plugin_data * const p)
SETDEFAULTS_FUNC(mod_cgi_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("cgi.assign"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("cgi.execute-x-only"),
T_CONFIG_BOOL,
@ -198,7 +198,7 @@ SETDEFAULTS_FUNC(mod_cgi_set_defaults) {
T_CONFIG_BOOL,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("cgi.x-sendfile-docroot"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("cgi.local-redir"),
T_CONFIG_BOOL,
@ -222,25 +222,10 @@ SETDEFAULTS_FUNC(mod_cgi_set_defaults) {
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* cgi.assign */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"ext\" -> \"exepath\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
case 1: /* cgi.execute-x-only */
case 2: /* cgi.x-sendfile */
break;
case 3: /* cgi.x-sendfile-docroot */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected: %s = ( \"/allowed/path\", ... )",
cpk[cpv->k_id].k, cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
for (uint32_t j = 0; j < cpv->v.a->used; ++j) {
data_string *ds = (data_string *)cpv->v.a->data[j];
if (ds->value.ptr[0] != '/') {

8
src/mod_cml.c

@ -122,7 +122,7 @@ SETDEFAULTS_FUNC(mod_cml_set_defaults) {
T_CONFIG_STRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("cml.memcache-hosts"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("cml.memcache-namespace"), /*(unused)*/
T_CONFIG_STRING,
@ -148,12 +148,6 @@ SETDEFAULTS_FUNC(mod_cml_set_defaults) {
case 0: /* cml.extension */
break;
case 1: /* cml.memcache-hosts */ /* config converted to memc handles */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"host\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
if (!mod_cml_init_memcached(srv, cpv)) {
return HANDLER_ERROR;
}

16
src/mod_compress.c

@ -222,10 +222,10 @@ static short mod_compress_encodings_to_flags(const array *encodings) {
SETDEFAULTS_FUNC(mod_compress_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("compress.filetype"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("compress.allowed-encodings"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("compress.cache-dir"),
T_CONFIG_STRING,
@ -252,21 +252,9 @@ SETDEFAULTS_FUNC(mod_compress_set_defaults) {
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* compress.filetype */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"mimetype\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
if (0 == cpv->v.a->used) cpv->v.a = NULL;
break;
case 1: /* compress.allowed-encodings */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"encoding\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
cpv->v.u = (unsigned int)
mod_compress_encodings_to_flags(cpv->v.a);
cpv->vtype = T_CONFIG_INT;

16
src/mod_deflate.c

@ -329,10 +329,10 @@ static short mod_deflate_encodings_to_flags(const array *encodings) {
SETDEFAULTS_FUNC(mod_deflate_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("deflate.mimetypes"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("deflate.allow-encodings"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("deflate.max-compress-size"),
T_CONFIG_INT,
@ -368,12 +368,6 @@ SETDEFAULTS_FUNC(mod_deflate_set_defaults) {
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* deflate.mimetypes */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"mimetype\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
/* mod_deflate matches mimetype as prefix of Content-Type
* so ignore '*' at end of mimetype for end-user flexibility
* in specifying trailing wildcard to grouping of mimetypes */
@ -386,12 +380,6 @@ SETDEFAULTS_FUNC(mod_deflate_set_defaults) {
if (0 == cpv->v.a->used) cpv->v.a = NULL;
break;
case 1: /* deflate.allowed-encodings */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"encoding\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
cpv->v.shrt = (unsigned short)
mod_deflate_encodings_to_flags(cpv->v.a);
cpv->vtype = T_CONFIG_SHORT;

8
src/mod_dirlisting.c

@ -206,7 +206,7 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
T_CONFIG_BOOL,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("dir-listing.exclude"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("dir-listing.hide-dot-files"),
T_CONFIG_BOOL,
@ -263,12 +263,6 @@ SETDEFAULTS_FUNC(mod_dirlisting_set_defaults) {
case 1: /* server.dir-listing *//*(historical)*/
break;
case 2: /* dir-listing.exclude */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"regex\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
#ifndef HAVE_PCRE_H
if (cpv->v.a->used > 0) {
log_error(srv->errh, __FILE__, __LINE__,

18
src/mod_expire.c

@ -195,10 +195,10 @@ static void mod_expire_patch_config(connection * const con, plugin_data * const
SETDEFAULTS_FUNC(mod_expire_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("expire.url"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("expire.mimetypes"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -217,23 +217,9 @@ SETDEFAULTS_FUNC(mod_expire_set_defaults) {
const array *a = NULL;
switch (cpv->k_id) {
case 0: /* expire.url */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"urlpath\" => \"expiration\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
a = cpv->v.a;
break;
case 1: /* expire.mimetypes */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"mimetype\" => \"expiration\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
for (uint32_t k = 0; k < cpv->v.a->used; ++k) {
data_string *ds = (data_string *)cpv->v.a->data[k];
/*(omit trailing '*', if present, from prefix match)*/

26
src/mod_extforward.c

@ -327,13 +327,13 @@ static unsigned int mod_extforward_parse_opts(server *srv, const array *opts_par
SETDEFAULTS_FUNC(mod_extforward_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("extforward.forwarder"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("extforward.headers"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("extforward.params"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVANY,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("extforward.hap-PROXY"),
T_CONFIG_BOOL,
@ -359,13 +359,6 @@ SETDEFAULTS_FUNC(mod_extforward_set_defaults) {
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* extforward.forwarder */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"IPaddr\" => \"trust\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
cpv->v.v = mod_extforward_parse_forwarder(srv, cpv->v.a);
if (NULL == cpv->v.v) {
log_error(srv->errh, __FILE__, __LINE__,
@ -375,21 +368,8 @@ SETDEFAULTS_FUNC(mod_extforward_set_defaults) {
cpv->vtype = T_CONFIG_LOCAL;
break;
case 1: /* extforward.headers */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"headername\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
case 2: /* extforward.params */
if (!array_is_kvany(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"param\" => \"value\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
cpv->v.u = mod_extforward_parse_opts(srv, cpv->v.a);
if (UINT_MAX == cpv->v.u)
return HANDLER_ERROR;

12
src/mod_fastcgi.c

@ -78,7 +78,7 @@ static void mod_fastcgi_patch_config(connection * const con, plugin_data * const
SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("fastcgi.server"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVARRAY,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("fastcgi.balance"),
T_CONFIG_STRING,
@ -87,7 +87,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
T_CONFIG_INT,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("fastcgi.map-extensions"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -120,15 +120,7 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) {
cpv->v.u = (unsigned int)gw_get_defaults_balance(srv, cpv->v.b);
break;
case 2: /* fastcgi.debug */
break;
case 3: /* fastcgi.map-extensions */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"suffix\" => \"subst\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
default:/* should not happen */
break;

22
src/mod_flv_streaming.c

@ -54,7 +54,7 @@ static void mod_flv_streaming_patch_config(connection * const con, plugin_data *
SETDEFAULTS_FUNC(mod_flv_streaming_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("flv-streaming.extensions"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -65,26 +65,6 @@ SETDEFAULTS_FUNC(mod_flv_streaming_set_defaults) {
if (!config_plugin_values_init(srv, p, cpk, "mod_flv_streaming"))
return HANDLER_ERROR;
/* process and validate config directives
* (init i to 0 if global context; to 1 to skip empty global context) */
for (int i = !p->cvlist[0].v.u2[1]; i < p->nconfig; ++i) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist[i].v.u2[0];
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* flv-streaming.extensions */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"ext\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
default:/* should not happen */
break;
}
}
}
/* initialize p->defaults from global config context */
if (p->nconfig > 0 && p->cvlist->v.u2[1]) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist->v.u2[0];

25
src/mod_indexfile.c

@ -58,10 +58,10 @@ static void mod_indexfile_patch_config(connection * const con, plugin_data * con
SETDEFAULTS_FUNC(mod_indexfile_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("index-file.names"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("server.indexfiles"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -72,27 +72,6 @@ SETDEFAULTS_FUNC(mod_indexfile_set_defaults) {
if (!config_plugin_values_init(srv, p, cpk, "mod_indexfile"))
return HANDLER_ERROR;
/* process and validate config directives
* (init i to 0 if global context; to 1 to skip empty global context) */
for (int i = !p->cvlist[0].v.u2[1]; i < p->nconfig; ++i) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist[i].v.u2[0];
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* index-file.names */
case 1: /* server.indexfiles */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"file\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
default:/* should not happen */
break;
}
}
}
/* initialize p->defaults from global config context */
if (p->nconfig > 0 && p->cvlist->v.u2[1]) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist->v.u2[0];

10
src/mod_magnet.c

@ -81,10 +81,10 @@ static void mod_magnet_patch_config(connection * const con, plugin_data * const
SETDEFAULTS_FUNC(mod_magnet_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("magnet.attract-raw-url-to"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("magnet.attract-physical-path-to"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -103,12 +103,6 @@ SETDEFAULTS_FUNC(mod_magnet_set_defaults) {
switch (cpv->k_id) {
case 0: /* magnet.attract-raw-url-to */
case 1: /* magnet.attract-physical-path-to */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"scriptpath\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
for (uint32_t j = 0; j < cpv->v.a->used; ++j) {
data_string *ds = (data_string *)cpv->v.a->data[j];
if (buffer_string_is_empty(&ds->value)) {

2
src/mod_maxminddb.c

@ -278,7 +278,7 @@ SETDEFAULTS_FUNC(mod_maxminddb_set_defaults)
T_CONFIG_STRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("maxminddb.env"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,

8
src/mod_openssl.c

@ -1302,7 +1302,7 @@ mod_openssl_set_defaults_sockets(server *srv, plugin_data *p)
T_CONFIG_STRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("ssl.openssl.ssl-conf-cmd"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("ssl.pemfile"), /* included to process global scope */
T_CONFIG_STRING,
@ -1382,12 +1382,6 @@ mod_openssl_set_defaults_sockets(server *srv, plugin_data *p)
break;
case 5: /* ssl.openssl.ssl-conf-cmd */
*(const array **)&conf.ssl_conf_cmd = cpv->v.a;
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"%s must be array of \"key\" => \"value\" strings",
cpk[cpv->k_id].k);
rc = HANDLER_ERROR;
}
break;
case 6: /* ssl.pemfile */
/* ignore here; included to process global scope when

30
src/mod_proxy.c

@ -282,7 +282,7 @@ SETDEFAULTS_FUNC(mod_proxy_set_defaults)
{
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("proxy.server"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVARRAY,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("proxy.balance"),
T_CONFIG_STRING,
@ -291,13 +291,13 @@ SETDEFAULTS_FUNC(mod_proxy_set_defaults)
T_CONFIG_INT,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("proxy.map-extensions"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("proxy.forwarded"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVANY,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("proxy.header"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVANY,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("proxy.replace-http-host"),
T_CONFIG_BOOL,
@ -343,36 +343,14 @@ SETDEFAULTS_FUNC(mod_proxy_set_defaults)
cpv->v.u = (unsigned int)gw_get_defaults_balance(srv, cpv->v.b);
break;
case 2: /* proxy.debug */
break;
case 3: /* proxy.map-extensions */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"suffix\" => \"subst\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
case 4: /* proxy.forwarded */
if (!array_is_kvany(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected ( \"param\" => \"value\" )",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
cpv->v.u = mod_proxy_parse_forwarded(srv, cpv->v.a);
if (UINT_MAX == cpv->v.u) return HANDLER_ERROR;
cpv->vtype = T_CONFIG_LOCAL;
break;
case 5: /* proxy.header */
if (!array_is_kvany(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected ( \"param\" => ( \"key\" => \"value\" ) )",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
cpv->v.v = mod_proxy_parse_header_opts(srv, cpv->v.a);
if (NULL == cpv->v.v) return HANDLER_ERROR;
cpv->vtype = T_CONFIG_LOCAL;

9
src/mod_redirect.c

@ -97,7 +97,7 @@ static pcre_keyvalue_buffer * mod_redirect_parse_list(server *srv, const array *
SETDEFAULTS_FUNC(mod_redirect_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("url.redirect"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("url.redirect-code"),
T_CONFIG_SHORT,
@ -118,13 +118,6 @@ SETDEFAULTS_FUNC(mod_redirect_set_defaults) {
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* url.redirect */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"regex\" => \"redirect\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
cpv->v.v =
mod_redirect_parse_list(srv, cpv->v.a, p->cvlist[i].k_id);
if (NULL == cpv->v.v) return HANDLER_ERROR;

40
src/mod_rewrite.c

@ -92,15 +92,7 @@ static void mod_rewrite_patch_config(connection * const con, plugin_data * const
}
}
static pcre_keyvalue_buffer * mod_rewrite_parse_list(server *srv, const array *a, pcre_keyvalue_buffer *kvb, const int condidx, const char *option) {
if (!array_is_kvstring(a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"regex\" => \"subst\"",
option);
return NULL;
}
static pcre_keyvalue_buffer * mod_rewrite_parse_list(server *srv, const array *a, pcre_keyvalue_buffer *kvb, const int condidx) {
int allocated = 0;
if (NULL == kvb) {
allocated = 1;
@ -128,22 +120,22 @@ static pcre_keyvalue_buffer * mod_rewrite_parse_list(server *srv, const array *a
SETDEFAULTS_FUNC(mod_rewrite_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("url.rewrite-once"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("url.rewrite-final"), /* old name => url.rewrite-once */
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("url.rewrite"), /* old name => url.rewrite-once */
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("url.rewrite-repeat"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("url.rewrite-if-not-file"), /* rewrite-once if ENOENT */
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("url.rewrite-repeat-if-not-file"), /* repeat if ENOENT */
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -191,24 +183,21 @@ SETDEFAULTS_FUNC(mod_rewrite_set_defaults) {
pcre_keyvalue_buffer *kvb = NULL, *kvb_NF = NULL;
if ((cpv = rewrite_once)) {
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb, condidx,
cpk[cpv->k_id].k); /* directive */
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb, condidx);
if (NULL == cpv->v.v) return HANDLER_ERROR;
cpv->vtype = T_CONFIG_LOCAL;
kvb = cpv->v.v;
}
if ((cpv = rewrite_final)) {
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb, condidx,
cpk[cpv->k_id].k); /* directive */
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb, condidx);
if (NULL == cpv->v.v) return HANDLER_ERROR;
cpv->vtype = T_CONFIG_LOCAL;
kvb = cpv->v.v;
}
if ((cpv = rewrite)) {
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb, condidx,
cpk[cpv->k_id].k); /* directive */
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb, condidx);
if (NULL == cpv->v.v) return HANDLER_ERROR;
cpv->vtype = T_CONFIG_LOCAL;
kvb = cpv->v.v;
@ -217,16 +206,14 @@ SETDEFAULTS_FUNC(mod_rewrite_set_defaults) {
if (kvb) kvb->x1 = (unsigned short)kvb->used; /* repeat_idx */
if ((cpv = rewrite_repeat)) {
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb, condidx,
cpk[cpv->k_id].k); /* directive */
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb, condidx);
if (NULL == cpv->v.v) return HANDLER_ERROR;
cpv->vtype = T_CONFIG_LOCAL;
/*kvb = cpv->v.v;*/
}
if ((cpv = rewrite_NF)) {
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb_NF, condidx,
cpk[cpv->k_id].k); /* directive */
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb_NF, condidx);
if (NULL == cpv->v.v) return HANDLER_ERROR;
cpv->vtype = T_CONFIG_LOCAL;
kvb_NF = cpv->v.v;
@ -235,8 +222,7 @@ SETDEFAULTS_FUNC(mod_rewrite_set_defaults) {
if (kvb_NF) kvb_NF->x1 = (unsigned short)kvb_NF->used; /* repeat_idx */
if ((cpv = rewrite_repeat_NF)) {
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb_NF, condidx,
cpk[cpv->k_id].k); /* directive */
cpv->v.v = mod_rewrite_parse_list(srv, cpv->v.a, kvb_NF, condidx);
if (NULL == cpv->v.v) return HANDLER_ERROR;
cpv->vtype = T_CONFIG_LOCAL;
/*kvb_NF = cpv->v.v;*/

12
src/mod_scgi.c

@ -65,7 +65,7 @@ static void mod_scgi_patch_config(connection * const con, plugin_data * const p)
SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("scgi.server"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVARRAY,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("scgi.balance"),
T_CONFIG_STRING,
@ -74,7 +74,7 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
T_CONFIG_INT,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("scgi.map-extensions"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("scgi.protocol"),
T_CONFIG_STRING,
@ -110,15 +110,7 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) {
cpv->v.u = (unsigned int)gw_get_defaults_balance(srv, cpv->v.b);
break;
case 2: /* scgi.debug */
break;
case 3: /* scgi.map-extensions */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"suffix\" => \"subst\"",
cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
case 4: /* scgi.protocol */
if (buffer_eq_slen(cpv->v.b, CONST_STR_LEN("scgi")))

18
src/mod_setenv.c

@ -87,22 +87,22 @@ static void mod_setenv_patch_config(connection * const con, plugin_data * const
SETDEFAULTS_FUNC(mod_setenv_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("setenv.add-request-header"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("setenv.add-response-header"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("setenv.add-environment"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("setenv.set-request-header"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("setenv.set-response-header"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("setenv.set-environment"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVSTRING,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -130,12 +130,6 @@ SETDEFAULTS_FUNC(mod_setenv_set_defaults) {
case 3: /* setenv.set-request-header */
case 4: /* setenv.set-response-header */
case 5: /* setenv.set-environment */
if (!array_is_kvstring(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"key\" => \"value\"",cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
default:/* should not happen */
break;

22
src/mod_skeleton.c

@ -88,7 +88,7 @@ static void mod_skeleton_patch_config(connection * const con, plugin_data * cons
SETDEFAULTS_FUNC(mod_skeleton_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("skeleton.array"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ NULL, 0,
T_CONFIG_UNSET,
@ -99,26 +99,6 @@ SETDEFAULTS_FUNC(mod_skeleton_set_defaults) {
if (!config_plugin_values_init(srv, p, cpk, "mod_skeleton"))
return HANDLER_ERROR;
/* process and validate config directives
* (init i to 0 if global context; to 1 to skip empty global context) */
for (int i = !p->cvlist[0].v.u2[1]; i < p->nconfig; ++i) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist[i].v.u2[0];
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* static-file.exclude-extensions */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"url-path\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
default:/* should not happen */
break;
}
}
}
/* initialize p->defaults from global config context */
if (p->nconfig > 0 && p->cvlist->v.u2[1]) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist->v.u2[0];

2
src/mod_sockproxy.c

@ -59,7 +59,7 @@ static void mod_sockproxy_patch_config(connection * const con, plugin_data * con
SETDEFAULTS_FUNC(mod_sockproxy_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("sockproxy.server"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_KVARRAY,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("sockproxy.balance"),
T_CONFIG_STRING,

27
src/mod_ssi.c

@ -118,7 +118,7 @@ static void mod_ssi_patch_config(connection * const con, plugin_data * const p)
SETDEFAULTS_FUNC(mod_ssi_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("ssi.extension"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("ssi.content-type"),
T_CONFIG_STRING,
@ -141,31 +141,6 @@ SETDEFAULTS_FUNC(mod_ssi_set_defaults) {
if (!config_plugin_values_init(srv, p, cpk, "mod_ssi"))
return HANDLER_ERROR;
/* process and validate config directives
* (init i to 0 if global context; to 1 to skip empty global context) */
for (int i = !p->cvlist[0].v.u2[1]; i < p->nconfig; ++i) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist[i].v.u2[0];
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* ssi.extension */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"ext\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
case 1: /* ssi.content-type */
case 2: /* ssi.conditional-requests */
case 3: /* ssi.exec */
case 4: /* ssi.recursion-max */
break;
default:/* should not happen */
break;
}
}
}
p->defaults.ssi_exec = 1;
/* initialize p->defaults from global config context */

22
src/mod_staticfile.c

@ -67,7 +67,7 @@ static void mod_staticfile_patch_config(connection * const con, plugin_data * co
SETDEFAULTS_FUNC(mod_staticfile_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("static-file.exclude-extensions"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("static-file.etags"),
T_CONFIG_BOOL,
@ -84,26 +84,6 @@ SETDEFAULTS_FUNC(mod_staticfile_set_defaults) {
if (!config_plugin_values_init(srv, p, cpk, "mod_staticfile"))
return HANDLER_ERROR;
/* process and validate config directives
* (init i to 0 if global context; to 1 to skip empty global context) */
for (int i = !p->cvlist[0].v.u2[1]; i < p->nconfig; ++i) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist[i].v.u2[0];
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* static-file.exclude-extensions */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"ext\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
default:/* should not happen */
break;
}
}
}
/* initialize p->defaults from global config context */
p->defaults.etags_used = 1; /* etags enabled */
if (p->nconfig > 0 && p->cvlist->v.u2[1]) {

8
src/mod_trigger_b4_dl.c

@ -258,7 +258,7 @@ SETDEFAULTS_FUNC(mod_trigger_b4_dl_set_defaults) {
T_CONFIG_SHORT,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("trigger-before-download.memcache-hosts"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("trigger-before-download.memcache-namespace"),
T_CONFIG_STRING,
@ -297,12 +297,6 @@ SETDEFAULTS_FUNC(mod_trigger_b4_dl_set_defaults) {
case 4: /* trigger-before-download.trigger-timeout */
break;
case 5: /* trigger-before-download.memcache-hosts */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"host\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
if (!mod_trigger_b4_dl_init_memcached(srv, cpv))
return HANDLER_ERROR;
break;

31
src/mod_userdir.c

@ -82,10 +82,10 @@ SETDEFAULTS_FUNC(mod_userdir_set_defaults) {
T_CONFIG_STRING,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("userdir.exclude-user"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("userdir.include-user"),
T_CONFIG_ARRAY,
T_CONFIG_ARRAY_VLIST,
T_CONFIG_SCOPE_CONNECTION }
,{ CONST_STR_LEN("userdir.basepath"),
T_CONFIG_STRING,
@ -105,33 +105,6 @@ SETDEFAULTS_FUNC(mod_userdir_set_defaults) {
if (!config_plugin_values_init(srv, p, cpk, "mod_userdir"))
return HANDLER_ERROR;
/* process and validate config directives
* (init i to 0 if global context; to 1 to skip empty global context) */
for (int i = !p->cvlist[0].v.u2[1]; i < p->nconfig; ++i) {
const config_plugin_value_t *cpv = p->cvlist + p->cvlist[i].v.u2[0];
for (; -1 != cpv->k_id; ++cpv) {
switch (cpv->k_id) {
case 0: /* userdir.path */
break;
case 1: /* userdir.exclude-user */
case 2: /* userdir.include-user */
if (!array_is_vlist(cpv->v.a)) {
log_error(srv->errh, __FILE__, __LINE__,
"unexpected value for %s; "
"expected list of \"suffix\"", cpk[cpv->k_id].k);
return HANDLER_ERROR;
}
break;
case 3: /* userdir.basepath */
case 4: /* userdir.letterhomes */
case 5: /* userdir.active */
break;
default:/* should not happen */
break;
}
}
}
/* enabled by default for backward compatibility;
* if userdir.path isn't set userdir is disabled too,
* but you can't disable it by setting it to an empty string. */

9
src/mod_vhostdb_dbi.c

@ -279,7 +279,7 @@ static void mod_vhostdb_patch_config(connection * const con, plugin_data * const
SETDEFAULTS_FUNC(mod_vhostdb_set_defaults) {
static const config_plugin_keys_t cpk[] = {
{ CONST_STR_LEN("vhostdb.dbi"),
T_CONFIG_ARRAY,