From 64be8717bdc2f0f8f11cbb8d18a0f96d2c24c6d3 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Mon, 16 Sep 2019 20:17:42 +0300 Subject: Configuration: added ability to access object members with slashes. Now URI encoding can be used to escape "/" in the request path: GET /config/listeners/unix:%2Fpath%2Fto%2Fsocket/ --- src/nxt_conf.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/nxt_conf.c') diff --git a/src/nxt_conf.c b/src/nxt_conf.c index 57870838..ff82e1d2 100644 --- a/src/nxt_conf.c +++ b/src/nxt_conf.c @@ -416,10 +416,13 @@ static void nxt_conf_path_next_token(nxt_conf_path_parse_t *parse, nxt_conf_value_t * nxt_conf_get_path(nxt_conf_value_t *value, nxt_str_t *path) { + u_char *end; nxt_str_t token; nxt_int_t index; nxt_conf_path_parse_t parse; + u_char buf[256]; + parse.start = path->start; parse.end = path->start + path->length; parse.last = 0; @@ -436,6 +439,18 @@ nxt_conf_get_path(nxt_conf_value_t *value, nxt_str_t *path) return NULL; } + if (nxt_slow_path(token.length > 256)) { + return NULL; + } + + end = nxt_decode_uri(buf, token.start, token.length); + if (nxt_slow_path(end == NULL)) { + return NULL; + } + + token.length = end - buf; + token.start = buf; + switch (value->type) { case NXT_CONF_VALUE_OBJECT: -- cgit