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/
This commit is contained in:
Valentin Bartenev
2019-09-16 20:17:42 +03:00
parent b5394c3956
commit 64be8717bd
6 changed files with 105 additions and 5 deletions

View File

@@ -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: