summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2019-09-16 20:17:42 +0300
committerValentin Bartenev <vbart@nginx.com>2019-09-16 20:17:42 +0300
commit64be8717bdc2f0f8f11cbb8d18a0f96d2c24c6d3 (patch)
tree1539675a0756c9356719fd6b679eabea840983dc /src/nxt_conf.c
parentb5394c39568d9895d5c84862e7a209b76f98bea9 (diff)
downloadunit-64be8717bdc2f0f8f11cbb8d18a0f96d2c24c6d3.tar.gz
unit-64be8717bdc2f0f8f11cbb8d18a0f96d2c24c6d3.tar.bz2
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/
Diffstat (limited to '')
-rw-r--r--src/nxt_conf.c15
1 files changed, 15 insertions, 0 deletions
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: