diff options
author | Zhidao HONG <z.hong@f5.com> | 2024-04-18 18:16:01 +0800 |
---|---|---|
committer | Zhidao HONG <z.hong@f5.com> | 2024-08-20 09:17:23 +0800 |
commit | 2eecee7520558a8f72e98e839a77330712a946b4 (patch) | |
tree | ad98b468f69f3575eec232a5e30faeea8b86fbc6 /src/nxt_http_set_headers.c | |
parent | 76489fb7e0ab9142651b91ee8072c6cda270dd09 (diff) | |
download | unit-2eecee7520558a8f72e98e839a77330712a946b4.tar.gz unit-2eecee7520558a8f72e98e839a77330712a946b4.tar.bz2 |
var: Restrict nxt_tstr_query() to only support synchronous operation
Initially, variable query was designed to accomodate both synchronous
and asynchronous operations. However, upon consideration of actual
requirements, we recognized that asynchronous support was not needed.
The refactoring ensures that the success or failure of the variable
query operation is now directly indicated by its return value. This
change streamlines the function's usage and enhances code clarity,
as it facilitates immediate error handling without the need for
asynchronous callbacks or additional error checking functions.
Note the patch only works for Unit native variables but not njs
variables.
Diffstat (limited to 'src/nxt_http_set_headers.c')
-rw-r--r-- | src/nxt_http_set_headers.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nxt_http_set_headers.c b/src/nxt_http_set_headers.c index 25dd7478..7fd6aba5 100644 --- a/src/nxt_http_set_headers.c +++ b/src/nxt_http_set_headers.c @@ -139,9 +139,8 @@ nxt_http_set_headers(nxt_http_request_t *r) return NXT_ERROR; } - nxt_tstr_query(&r->task, r->tstr_query, hv->value, &value[i]); - - if (nxt_slow_path(nxt_tstr_query_failed(r->tstr_query))) { + ret = nxt_tstr_query(&r->task, r->tstr_query, hv->value, &value[i]); + if (nxt_slow_path(ret != NXT_OK)) { return NXT_ERROR; } } |