diff options
author | Zhidao HONG <z.hong@f5.com> | 2021-10-09 10:44:31 +0800 |
---|---|---|
committer | Zhidao HONG <z.hong@f5.com> | 2021-10-09 10:44:31 +0800 |
commit | 5fa5b1464f2a0623bb7ee7c68ff6f9d18e744ed4 (patch) | |
tree | c21804dcbcf7ad1294e22b43c2a350758c6ffe7f /src/nxt_conf_validation.c | |
parent | af283833dd019ed48970abb740131fb1403da550 (diff) | |
download | unit-5fa5b1464f2a0623bb7ee7c68ff6f9d18e744ed4.tar.gz unit-5fa5b1464f2a0623bb7ee7c68ff6f9d18e744ed4.tar.bz2 |
Configuration: automatic migration to the new "share" behavior.
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 55107cd6..5701ae17 100644 --- a/src/nxt_conf_validation.c +++ b/src/nxt_conf_validation.c @@ -1624,6 +1624,11 @@ static nxt_int_t nxt_conf_vldt_share(nxt_conf_validation_t *vldt, nxt_conf_value_t *value, void *data) { + u_char *p; + nxt_str_t name, temp; + + static nxt_str_t uri = nxt_string("$uri"); + if (nxt_conf_type(value) == NXT_CONF_ARRAY) { if (nxt_conf_array_elements_count(value) == 0) { return nxt_conf_vldt_error(vldt, "The \"share\" array " @@ -1636,6 +1641,22 @@ nxt_conf_vldt_share(nxt_conf_validation_t *vldt, nxt_conf_value_t *value, /* NXT_CONF_STRING */ + if (vldt->ver < 12600) { + nxt_conf_get_string(value, &name); + + temp.length = name.length + uri.length; + + temp.start = nxt_mp_get(vldt->conf_pool, temp.length); + if (nxt_slow_path(temp.start == NULL)) { + return NXT_ERROR; + } + + p = nxt_cpymem(temp.start, name.start, name.length); + nxt_memcpy(p, uri.start, uri.length); + + nxt_conf_set_string(value, &temp); + } + return nxt_conf_vldt_share_element(vldt, value); } |