diff options
author | Valentin Bartenev <vbart@nginx.com> | 2020-08-13 02:46:54 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2020-08-13 02:46:54 +0300 |
commit | 93146616cf56a94fc2979cb978c7b451c5592594 (patch) | |
tree | db840e75ef2c08731e699b4eb44641ad6639c2ca /src/nxt_conf_validation.c | |
parent | 21ac95f17e70f2f20fe8e2a99bbe9cc7328a6e62 (diff) | |
download | unit-93146616cf56a94fc2979cb978c7b451c5592594.tar.gz unit-93146616cf56a94fc2979cb978c7b451c5592594.tar.bz2 |
Basic variables support.
Diffstat (limited to '')
-rw-r--r-- | src/nxt_conf_validation.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c index a5e0663f..b5530b85 100644 --- a/src/nxt_conf_validation.c +++ b/src/nxt_conf_validation.c @@ -64,6 +64,8 @@ static nxt_int_t nxt_conf_vldt_type(nxt_conf_validation_t *vldt, nxt_str_t *name, nxt_conf_value_t *value, nxt_conf_vldt_type_t type); static nxt_int_t nxt_conf_vldt_error(nxt_conf_validation_t *vldt, const char *fmt, ...); +static nxt_int_t nxt_conf_vldt_var(nxt_conf_validation_t *vldt, + const char *option, nxt_str_t *value); static nxt_int_t nxt_conf_vldt_mtypes(nxt_conf_validation_t *vldt, nxt_conf_value_t *value, void *data); @@ -1065,6 +1067,21 @@ nxt_conf_vldt_error(nxt_conf_validation_t *vldt, const char *fmt, ...) } +static nxt_int_t +nxt_conf_vldt_var(nxt_conf_validation_t *vldt, const char *option, + nxt_str_t *value) +{ + u_char error[NXT_MAX_ERROR_STR]; + + if (nxt_var_test(value, error) != NXT_OK) { + return nxt_conf_vldt_error(vldt, "%s in the \"%s\" value.", + error, option); + } + + return NXT_OK; +} + + typedef struct { nxt_mp_t *pool; nxt_str_t *type; @@ -1242,6 +1259,10 @@ nxt_conf_vldt_pass(nxt_conf_validation_t *vldt, nxt_conf_value_t *value, nxt_conf_get_string(value, &pass); + if (nxt_is_var(&pass)) { + return nxt_conf_vldt_var(vldt, "pass", &pass); + } + ret = nxt_http_pass_segments(vldt->pool, &pass, segments, 3); if (ret != NXT_OK) { |