summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf.h (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2024-04-25configuration: Constify more pointersAndrew Clayton1-4/+5
This continues the patch series constifying various pointers in the configuration sub-system. This is done as a separate commit as it involved a _slightly_ more invasive change in nxt_conf_get_string(). While it takes a value parameter that is never modified, simply making it const results in CC build/src/nxt_conf.o src/nxt_conf.c: In function ‘nxt_conf_get_string’: src/nxt_conf.c:170:20: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 170 | str->start = value->u.str.start; | ^ due to the assignment operator. Making value const will allow for numerous other constification and seeing as we are not modifying it, seems worthwhile. We can get around the warning by casting ->u.{str,string}.start Reviewed-by: Zhidao HONG <z.hong@f5.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-04-25configuration: Constify numerous pointersAndrew Clayton1-27/+32
Mark numerous function argument pointers as 'const' in the configuration sub-system. This also does the same with a few functions in src/nxt_conf_validation.c that are required to accomplish the below, attacking the rest is an exercise for another day... While this is a worthwhile hardening exercise in its own right, the main impetus for this is to 'constify' some local function variables which are currently defined with 'static' storage class and turn them into 'static const', which will be done in a subsequent patch. Reviewed-by: Zhidao HONG <z.hong@f5.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-05Configuration: Add nxt_conf_get_string_dup()Alejandro Colomar1-0/+3
This function is like nxt_conf_get_string(), but creates a new copy, so that it can be modified without corrupting the configuration string. Reviewed-by: Andrew Clayton <a.clayton@nginx.com> Cc: Zhidao Hong <z.hong@f5.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
2022-11-20Var: separating nxt_tstr_t from nxt_var_t.Zhidao HONG1-1/+1
It's for the introduction of njs support. For each option that supports native variable and JS template literals introduced next, it's unified as template string. No functional changes.
2022-08-29Implemented basic statistics API.Valentin Bartenev1-0/+2
2022-07-14Var: dynamic variables support.Zhidao HONG1-0/+1
This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
2022-06-22Constified numerous function parameters.Andrew Clayton1-3/+3
As was pointed out by the cppcheck[0] static code analysis utility we can mark numerous function parameters as 'const'. This acts as a hint to the compiler about our intentions and the compiler will tell us when we deviate from them. [0]: https://cppcheck.sourceforge.io/
2022-04-26Added new array APIs that also work with non-arrays.Alejandro Colomar1-0/+4
Similar to how C pointers to variables can always be considered as pointers to the first element of an array of size 1 (see the following code for an example of how they are equivalent), treating non-NXT_CONF_VALUE_ARRAY as if they were NXT_CONF_VALUE_ARRAYs of size 1 allows for simpler and more generic code. void foo(ptrdiff_t sz, int arr[sz]) { for (ptrdiff_t i = 0; i < sz; i++) arr[i] = 0; } void bar(void) { int x; int y[1]; foo(1, &x); foo(1, y); } nxt_conf_array_elements_count_or_1(): Similar to nxt_conf_array_elements_count(). Return a size of 1 when input is non-array, instead of causing undefined behavior. That value (1) makes sense because it will be used as the limiter of a loop that loops over the array and calls nxt_conf_get_array_element_or_itself(), which will return a correct element for such loops. nxt_conf_get_array_element_or_itself(): Similar to nxt_conf_get_array_element(). Return the input pointer unmodified (i.e., a pointer to the unique element of a hypothetical array), instead of returning NULL, which wasn't very useful. nxt_conf_array_qsort(): Since it's a no-op for non-arrays, this API can be reused.
2022-04-26Added 'const' for read-only function parameter.Alejandro Colomar1-1/+1
That parameter is not being modified in the function. Make it 'const' to allow passing 'static const' variables.
2021-10-09Configuration: automatic migration to the new "share" behavior.Zhidao HONG1-0/+2
2020-05-14PHP: implemented "targets" option.Valentin Bartenev1-1/+1
This allows to specify multiple subsequent targets inside PHP applications. For example: { "listeners": { "*:80": { "pass": "routes" } }, "routes": [ { "match": { "uri": "/info" }, "action": { "pass": "applications/my_app/phpinfo" } }, { "match": { "uri": "/hello" }, "action": { "pass": "applications/my_app/hello" } }, { "action": { "pass": "applications/my_app/rest" } } ], "applications": { "my_app": { "type": "php", "targets": { "phpinfo": { "script": "phpinfo.php", "root": "/www/data/admin", }, "hello": { "script": "hello.php", "root": "/www/data/test", }, "rest": { "root": "/www/data/example.com", "index": "index.php" }, } } } }
2020-03-30Configuration: support for rational numbers.Valentin Bartenev1-1/+1
2019-10-11Fixed passing false in namespace flags.Tiago Natel1-0/+1
This patch closes #328 in github.
2019-09-19Basic support for serving static files.Valentin Bartenev1-0/+1
2019-04-24Configuration: support for POST operations on arrays.Valentin Bartenev1-2/+11
It allows to add an array element without specifying the index.
2019-02-28Introducing Java Servlet Container beta.Max Romanov1-1/+1
2019-02-26Introduced nxt_conf_array_qsort().Igor Sysoev1-0/+2
2019-02-26Introduced nxt_conf_array_elements_count().Igor Sysoev1-0/+1
2018-09-20Controller: certificates storage interface.Valentin Bartenev1-0/+12
2018-09-20Deduplicated string value initializations.Valentin Bartenev1-0/+1
2018-06-07Exported functions for accessing configuration values.Valentin Bartenev1-9/+10
2018-01-29Introducing extended app process management.Max Romanov1-0/+1
- Pre-fork 'processes.spare' application processes; - fork more processes to keep 'processes.spare' idle processes; - fork on-demand up to 'processes.max' count; - scale down idle application processes above 'processes.spare' after 'processes.idle_timeout'; - number of concurrently started application processes also limited by 'processes.spare' (or 1, if spare is 0).
2017-10-10Basic validation errors.Valentin Bartenev1-8/+17
2017-08-16Introduced nxt_conf_get_array_element().Valentin Bartenev1-0/+2
2017-08-16Object mapping interface extended with more string types.Valentin Bartenev1-2/+4
2017-08-11Controller: more HTTP headers and detailed JSON parsing errors.Valentin Bartenev1-3/+16
2017-07-18Configuration: reduced memory consumption of long strings.Valentin Bartenev1-2/+2
2017-07-10Configuration: nxt_conf_map_object() improvements.Valentin Bartenev1-1/+1
2017-07-06Controller: sending JSON configuration to router.Valentin Bartenev1-0/+8
2017-07-05Configuration: basic validation of schema.Valentin Bartenev1-0/+13
2017-06-29Added nxt_msec_t element to nxt_conf_map_object().Igor Sysoev1-0/+1
2017-06-28Configuration: reduced names of structures, functions, and macros.Valentin Bartenev1-36/+33
2017-06-28JSON property iterator nxt_conf_json_object_next_member().Igor Sysoev1-0/+2
2017-06-26Interface for mapping JSON configuration objects to C structures.Valentin Bartenev1-2/+25
2017-06-23Configuration printing functions splitted in two parts.Valentin Bartenev1-1/+3
Requested by Igor.
2017-06-23Renames and reordering of parameters in configuration parser functions.Valentin Bartenev1-10/+13
Requested by Igor.
2017-06-20Using new memory pool implementation.Igor Sysoev1-3/+3
2017-05-30Controller: support for partial PUT and DELETE operations.Valentin Bartenev1-1/+10
2017-05-26Style and a trivial fix.Valentin Bartenev1-1/+1
2017-05-23Optimized internal representation of JSON objects and arrays.Valentin Bartenev1-0/+2
2017-05-18Controller: partial retrieving of configuration.Valentin Bartenev1-0/+2
2017-05-16Controller: pretty-printing of JSON responses.Valentin Bartenev1-2/+8
2017-05-15Controller: trivial abilities to save and request configuration.Valentin Bartenev1-1/+1
Now you can get current configuration with: $ curl 127.0.0.1:8443 and put new configuration with: $ curl -X PUT -d @conf.json 127.0.0.1:8443
2017-04-11JSON output in controller.Valentin Bartenev1-0/+2
2017-04-10JSON parsing in controller.Valentin Bartenev1-0/+19