summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_var.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-08-20var: Remove unused functions and structure fieldsZhidao HONG1-6/+0
2024-03-08Var: Fix cacheable issue for njs variable accessZhidao HONG1-1/+1
The variables accessed with JS template literal should not be cacheable. Since it is parsed by njs engine, Unit can't create indexes on these variables for caching purpose. For example: { "format": "`{bodyLength:\"${vars.body_bytes_sent}\",status:\"${vars.status}\"}\n`" } The variables like the above are not cacheable. Closes: https://github.com/nginx/unit/issues/1169
2024-03-05Var: Remove a dead assignment in nxt_var_interpreter()Andrew Clayton1-1/+1
p is not used again before returning from the function. Found by the clang static analyser. Reviewed-by: Zhidao Hong <z.hong@f5.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-20Var: Introduced nxt_var_get()Zhidao HONG1-11/+37
This commit is for subsequent commits that will support njs variable accessing. In this commit, nxt_var_get() is introduced to extend the variable handling capabilities. Concurrently, nxt_var_ref_get() has been refactored to use in both configuration and request phases.
2024-02-20Var: Make nxt_var_cache_value() more generalZhidao HONG1-9/+9
This commit enhances nxt_var_cache_value() to enable variable access using string names, complementing the existing reference index method. The modification ensures future compatibility with njs variable access.
2024-02-20Var: Refactored nxt_http_unknown_var_ref()Zhidao HONG1-1/+1
2024-02-20Var: Refactored nxt_var_ref_get()Zhidao HONG1-6/+8
2023-06-19Variables refactoring.Zhidao HONG1-97/+69
This commit is to reimplement the variables with an unknown field such as $header_{name} to make the parsing more generic, it's a preparation for supporting response header variables.
2023-05-25HTTP: fixed variable caching.Zhidao HONG1-14/+24
When a variable is accessed in the Unit configuration, the value is cached. This was useful prior to the URI rewrite feature, but now that the URI (more precisely, the request target) can be rewritten, the contents of the variable $uri (which contains the path part of the request target, and is decoded) should not be cached anymore, or at least the cached value should be invalidated after a URI rewrite. Example: { "rewrite": "/prefix$uri", "share": "$uri" } For a request line like GET /foo?bar=baz HTTP/1.1\r\n, the expected file served in the response would be /prefix/foo, but due to the caching issue, Unit currently serves /foo.
2022-11-20Var: separating nxt_tstr_t from nxt_var_t.Zhidao HONG1-125/+23
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-11-20Var: improved variable parsing with empty names.Zhidao HONG1-43/+32
Unit parsed the case of "$uri$$host" into unknown variables. This commit makes it invalid variable instead.
2022-11-04Removed the unsafe nxt_memchr() wrapper for memchr(3).Alejandro Colomar1-1/+1
The casts are unnecessary, since memchr(3)'s argument is 'const void *'. It might have been necessary in the times of K&R, where 'void *' didn't exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can hide all classes of bugs by silencing most compiler warnings. The changes from nxt_memchr() to memchr(3) were scripted: $ find src/ -type f \ | grep '\.[ch]$' \ | xargs sed -i 's/nxt_memchr/memchr/' Reviewed-by: Andrew Clayton <a.clayton@nginx.com> Signed-off-by: Alejandro Colomar <alx@nginx.com>
2022-07-28Log: customizable access log format.Zhidao HONG1-5/+20
2022-07-14Var: dynamic variables support.Zhidao HONG1-6/+125
This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.
2022-07-14Var: optimization to get rid of nxt_var_cache_find().Zhidao HONG1-161/+84
No functional changes.
2022-06-15Var: relocated nxt_var_is_const() and nxt_var_raw().Zhidao HONG1-15/+15
No functional changes.
2022-06-02Summary: Var: removing all async stuff.Zhidao HONG1-9/+4
No functional changes.
2021-12-03Fixed debug message broken in 45b25ffb2e8c.Zhidao HONG1-1/+2
2021-09-28Static: variables in the "chroot" option.Zhidao HONG1-4/+16
2021-09-07Router: refactored variable pass.Zhidao HONG1-3/+17
Since the "pass" option supports both strings and variables, a generic nxt_var_t structure can be used in the configuration phase, and the "name" field in actions is redundant. No functional changes.
2021-09-06Var: keeping raw variable string for debug.Zhidao HONG1-75/+71
2020-08-13Basic variables support.Valentin Bartenev1-0/+616