diff options
Diffstat (limited to '')
-rw-r--r-- | src/nxt_conf_validation.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c index bee82dd4..45c0eb41 100644 --- a/src/nxt_conf_validation.c +++ b/src/nxt_conf_validation.c @@ -72,6 +72,8 @@ static nxt_int_t nxt_conf_vldt_match_patterns_set(nxt_conf_validation_t *vldt, nxt_conf_value_t *value); static nxt_int_t nxt_conf_vldt_match_patterns_set_member( nxt_conf_validation_t *vldt, nxt_str_t *name, nxt_conf_value_t *value); +static nxt_int_t nxt_conf_vldt_match_scheme_pattern(nxt_conf_validation_t *vldt, + nxt_conf_value_t *value, void *data); static nxt_int_t nxt_conf_vldt_app_name(nxt_conf_validation_t *vldt, nxt_conf_value_t *value, void *data); static nxt_int_t nxt_conf_vldt_app(nxt_conf_validation_t *vldt, @@ -214,6 +216,11 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_match_members[] = { &nxt_conf_vldt_match_patterns, NULL }, + { nxt_string("scheme"), + NXT_CONF_VLDT_STRING, + &nxt_conf_vldt_match_scheme_pattern, + NULL }, + { nxt_string("host"), NXT_CONF_VLDT_STRING | NXT_CONF_VLDT_ARRAY, &nxt_conf_vldt_match_patterns, @@ -820,6 +827,28 @@ nxt_conf_vldt_match_pattern(nxt_conf_validation_t *vldt, static nxt_int_t +nxt_conf_vldt_match_scheme_pattern(nxt_conf_validation_t *vldt, + nxt_conf_value_t *value, void *data) +{ + nxt_str_t scheme; + + static const nxt_str_t http = nxt_string("http"); + static const nxt_str_t https = nxt_string("https"); + + nxt_conf_get_string(value, &scheme); + + if (nxt_strcasestr_eq(&scheme, &http) + || nxt_strcasestr_eq(&scheme, &https)) + { + return NXT_OK; + } + + return nxt_conf_vldt_error(vldt, "The \"scheme\" can either be " + "\"http\" or \"https\"."); +} + + +static nxt_int_t nxt_conf_vldt_match_patterns_sets(nxt_conf_validation_t *vldt, nxt_conf_value_t *value, void *data) { |