nxt_conf.c (1049:961567625038) nxt_conf.c (1167:a49ee872e83d)
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 402 unchanged lines hidden (view full) ---

411
412static void nxt_conf_path_next_token(nxt_conf_path_parse_t *parse,
413 nxt_str_t *token);
414
415
416nxt_conf_value_t *
417nxt_conf_get_path(nxt_conf_value_t *value, nxt_str_t *path)
418{
1
2/*
3 * Copyright (C) Igor Sysoev
4 * Copyright (C) Valentin V. Bartenev
5 * Copyright (C) NGINX, Inc.
6 */
7
8#include <nxt_main.h>

--- 402 unchanged lines hidden (view full) ---

411
412static void nxt_conf_path_next_token(nxt_conf_path_parse_t *parse,
413 nxt_str_t *token);
414
415
416nxt_conf_value_t *
417nxt_conf_get_path(nxt_conf_value_t *value, nxt_str_t *path)
418{
419 u_char *end;
419 nxt_str_t token;
420 nxt_int_t index;
421 nxt_conf_path_parse_t parse;
422
420 nxt_str_t token;
421 nxt_int_t index;
422 nxt_conf_path_parse_t parse;
423
424 u_char buf[256];
425
423 parse.start = path->start;
424 parse.end = path->start + path->length;
425 parse.last = 0;
426
427 do {
428 nxt_conf_path_next_token(&parse, &token);
429
430 if (token.length == 0) {
431
432 if (parse.last) {
433 break;
434 }
435
436 return NULL;
437 }
438
426 parse.start = path->start;
427 parse.end = path->start + path->length;
428 parse.last = 0;
429
430 do {
431 nxt_conf_path_next_token(&parse, &token);
432
433 if (token.length == 0) {
434
435 if (parse.last) {
436 break;
437 }
438
439 return NULL;
440 }
441
442 if (nxt_slow_path(token.length > 256)) {
443 return NULL;
444 }
445
446 end = nxt_decode_uri(buf, token.start, token.length);
447 if (nxt_slow_path(end == NULL)) {
448 return NULL;
449 }
450
451 token.length = end - buf;
452 token.start = buf;
453
439 switch (value->type) {
440
441 case NXT_CONF_VALUE_OBJECT:
442 value = nxt_conf_get_object_member(value, &token, NULL);
443 break;
444
445 case NXT_CONF_VALUE_ARRAY:
446 index = nxt_int_parse(token.start, token.length);

--- 2121 unchanged lines hidden ---
454 switch (value->type) {
455
456 case NXT_CONF_VALUE_OBJECT:
457 value = nxt_conf_get_object_member(value, &token, NULL);
458 break;
459
460 case NXT_CONF_VALUE_ARRAY:
461 index = nxt_int_parse(token.start, token.length);

--- 2121 unchanged lines hidden ---