summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/nxt_http_request.c5
-rw-r--r--src/nxt_http_rewrite.c5
-rw-r--r--src/nxt_http_set_headers.c5
-rw-r--r--src/nxt_tstr.c12
-rw-r--r--src/nxt_tstr.h4
5 files changed, 15 insertions, 16 deletions
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c
index 54d1bd27..ccd2b141 100644
--- a/src/nxt_http_request.c
+++ b/src/nxt_http_request.c
@@ -936,9 +936,8 @@ nxt_http_request_access_log(nxt_task_t *task, nxt_http_request_t *r,
return NXT_DECLINED;
}
- nxt_tstr_query(task, r->tstr_query, rtcf->log_expr, &str);
-
- if (nxt_slow_path(nxt_tstr_query_failed(r->tstr_query))) {
+ ret = nxt_tstr_query(task, r->tstr_query, rtcf->log_expr, &str);
+ if (nxt_slow_path(ret != NXT_OK)) {
return NXT_DECLINED;
}
}
diff --git a/src/nxt_http_rewrite.c b/src/nxt_http_rewrite.c
index 661200ef..5de15ed7 100644
--- a/src/nxt_http_rewrite.c
+++ b/src/nxt_http_rewrite.c
@@ -52,9 +52,8 @@ nxt_http_rewrite(nxt_task_t *task, nxt_http_request_t *r)
return NXT_ERROR;
}
- nxt_tstr_query(task, r->tstr_query, action->rewrite, &str);
-
- if (nxt_slow_path(nxt_tstr_query_failed(r->tstr_query))) {
+ ret = nxt_tstr_query(task, r->tstr_query, action->rewrite, &str);
+ if (nxt_slow_path(ret != NXT_OK)) {
return NXT_ERROR;
}
}
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;
}
}
diff --git a/src/nxt_tstr.c b/src/nxt_tstr.c
index 6f39cff2..a72d7ddc 100644
--- a/src/nxt_tstr.c
+++ b/src/nxt_tstr.c
@@ -246,7 +246,7 @@ nxt_tstr_query_init(nxt_tstr_query_t **query_p, nxt_tstr_state_t *state,
}
-void
+nxt_int_t
nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
nxt_str_t *val)
{
@@ -254,11 +254,11 @@ nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
if (nxt_tstr_is_const(tstr)) {
nxt_tstr_str(tstr, val);
- return;
+ return NXT_OK;
}
if (nxt_slow_path(query->failed)) {
- return;
+ return NXT_ERROR;
}
if (tstr->type == NXT_TSTR_VAR) {
@@ -268,7 +268,7 @@ nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
if (nxt_slow_path(ret != NXT_OK)) {
query->failed = 1;
- return;
+ return NXT_ERROR;
}
} else {
@@ -278,7 +278,7 @@ nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
if (nxt_slow_path(ret != NXT_OK)) {
query->failed = 1;
- return;
+ return NXT_ERROR;
}
#endif
}
@@ -294,6 +294,8 @@ nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
nxt_debug(task, "tstr query: \"%V\", result: \"%V\"", &str, val);
#endif
+
+ return NXT_OK;
}
diff --git a/src/nxt_tstr.h b/src/nxt_tstr.h
index a156732d..574b4281 100644
--- a/src/nxt_tstr.h
+++ b/src/nxt_tstr.h
@@ -50,8 +50,8 @@ void nxt_tstr_str(nxt_tstr_t *tstr, nxt_str_t *str);
nxt_int_t nxt_tstr_query_init(nxt_tstr_query_t **query_p,
nxt_tstr_state_t *state, nxt_tstr_cache_t *cache, void *ctx,
nxt_mp_t *mp);
-void nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query, nxt_tstr_t *tstr,
- nxt_str_t *val);
+nxt_int_t nxt_tstr_query(nxt_task_t *task, nxt_tstr_query_t *query,
+ nxt_tstr_t *tstr, nxt_str_t *val);
nxt_bool_t nxt_tstr_query_failed(nxt_tstr_query_t *query);
void nxt_tstr_query_resolve(nxt_task_t *task, nxt_tstr_query_t *query,
void *data, nxt_work_handler_t ready, nxt_work_handler_t error);