Added routing based on request scheme.
Scheme matches exact string “http” or “https”.
This commit is contained in:
@@ -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,
|
||||
@@ -819,6 +826,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)
|
||||
|
||||
Reference in New Issue
Block a user