summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_rewrite.c
diff options
context:
space:
mode:
authorKonstantin Pavlov <thresh@nginx.com>2023-08-31 09:41:46 -0700
committerKonstantin Pavlov <thresh@nginx.com>2023-08-31 09:41:46 -0700
commitc45c8919c7232eb20023484f6d1fc9f1f50395d8 (patch)
treecc12eb307c1611494948645e4b487fa06495c3d2 /src/nxt_http_rewrite.c
parent88c90e1c351ab8c5bd487a5cd4b735014b08e271 (diff)
parent9b22b6957bc87b3df002d0bc691fdae6a20abdac (diff)
downloadunit-1.31.0-1.tar.gz
unit-1.31.0-1.tar.bz2
Merged with the default branch.1.31.0-1
Diffstat (limited to 'src/nxt_http_rewrite.c')
-rw-r--r--src/nxt_http_rewrite.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nxt_http_rewrite.c b/src/nxt_http_rewrite.c
index b800a919..ae5c865a 100644
--- a/src/nxt_http_rewrite.c
+++ b/src/nxt_http_rewrite.c
@@ -10,8 +10,8 @@
nxt_int_t
nxt_http_rewrite_init(nxt_router_conf_t *rtcf, nxt_http_action_t *action,
- nxt_http_action_conf_t *acf)
- {
+ nxt_http_action_conf_t *acf)
+{
nxt_str_t str;
nxt_conf_get_string(acf->rewrite, &str);
@@ -26,15 +26,21 @@ nxt_http_rewrite_init(nxt_router_conf_t *rtcf, nxt_http_action_t *action,
nxt_int_t
-nxt_http_rewrite(nxt_task_t *task, nxt_http_request_t *r,
- nxt_http_action_t *action)
+nxt_http_rewrite(nxt_task_t *task, nxt_http_request_t *r)
{
u_char *p;
nxt_int_t ret;
nxt_str_t str, encoded_path, target;
nxt_router_conf_t *rtcf;
+ nxt_http_action_t *action;
nxt_http_request_parse_t rp;
+ action = r->action;
+
+ if (action == NULL || action->rewrite == NULL) {
+ return NXT_OK;
+ }
+
if (nxt_tstr_is_const(action->rewrite)) {
nxt_tstr_str(action->rewrite, &str);