nxt_conf_validation.c (1961:69d823e5710a) nxt_conf_validation.c (1969:be6409cdb028)
1
2/*
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8#include <nxt_conf.h>

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

1619 return NXT_OK;
1620}
1621
1622
1623static nxt_int_t
1624nxt_conf_vldt_share(nxt_conf_validation_t *vldt, nxt_conf_value_t *value,
1625 void *data)
1626{
1
2/*
3 * Copyright (C) Valentin V. Bartenev
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include <nxt_main.h>
8#include <nxt_conf.h>

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

1619 return NXT_OK;
1620}
1621
1622
1623static nxt_int_t
1624nxt_conf_vldt_share(nxt_conf_validation_t *vldt, nxt_conf_value_t *value,
1625 void *data)
1626{
1627 u_char *p;
1628 nxt_str_t name, temp;
1629
1630 static nxt_str_t uri = nxt_string("$uri");
1631
1627 if (nxt_conf_type(value) == NXT_CONF_ARRAY) {
1628 if (nxt_conf_array_elements_count(value) == 0) {
1629 return nxt_conf_vldt_error(vldt, "The \"share\" array "
1630 "must contain at least one element.");
1631 }
1632
1633 return nxt_conf_vldt_array_iterator(vldt, value,
1634 &nxt_conf_vldt_share_element);
1635 }
1636
1637 /* NXT_CONF_STRING */
1638
1632 if (nxt_conf_type(value) == NXT_CONF_ARRAY) {
1633 if (nxt_conf_array_elements_count(value) == 0) {
1634 return nxt_conf_vldt_error(vldt, "The \"share\" array "
1635 "must contain at least one element.");
1636 }
1637
1638 return nxt_conf_vldt_array_iterator(vldt, value,
1639 &nxt_conf_vldt_share_element);
1640 }
1641
1642 /* NXT_CONF_STRING */
1643
1644 if (vldt->ver < 12600) {
1645 nxt_conf_get_string(value, &name);
1646
1647 temp.length = name.length + uri.length;
1648
1649 temp.start = nxt_mp_get(vldt->conf_pool, temp.length);
1650 if (nxt_slow_path(temp.start == NULL)) {
1651 return NXT_ERROR;
1652 }
1653
1654 p = nxt_cpymem(temp.start, name.start, name.length);
1655 nxt_memcpy(p, uri.start, uri.length);
1656
1657 nxt_conf_set_string(value, &temp);
1658 }
1659
1639 return nxt_conf_vldt_share_element(vldt, value);
1640}
1641
1642
1643static nxt_int_t
1644nxt_conf_vldt_share_element(nxt_conf_validation_t *vldt,
1645 nxt_conf_value_t *value)
1646{

--- 1330 unchanged lines hidden ---
1660 return nxt_conf_vldt_share_element(vldt, value);
1661}
1662
1663
1664static nxt_int_t
1665nxt_conf_vldt_share_element(nxt_conf_validation_t *vldt,
1666 nxt_conf_value_t *value)
1667{

--- 1330 unchanged lines hidden ---