aboutsummaryrefslogtreecommitdiff
path: root/nginx/ngx_http_js_module.c
diff options
context:
space:
mode:
authorAlexander Borisov <alexander.borisov@nginx.com>2020-10-08 18:47:04 +0300
committerAlexander Borisov <alexander.borisov@nginx.com>2020-10-08 18:47:04 +0300
commitdd7ab069c801dc83cfc0222cc692c34c7d248da1 (patch)
treee14f46914abf3eb1ea413b97f7ae8120c75982ad /nginx/ngx_http_js_module.c
parente4e2a809f92d7da2f56b4c8f3c5c323e4d22f8b3 (diff)
downloadnjs-dd7ab069c801dc83cfc0222cc692c34c7d248da1.tar.gz
njs-dd7ab069c801dc83cfc0222cc692c34c7d248da1.zip
HTTP: throwing an exception in internalRedirect() for a subrequest.
This closes #214 issue on GitHub.
Diffstat (limited to 'nginx/ngx_http_js_module.c')
-rw-r--r--nginx/ngx_http_js_module.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/nginx/ngx_http_js_module.c b/nginx/ngx_http_js_module.c
index e9132fd8..4e2f0077 100644
--- a/nginx/ngx_http_js_module.c
+++ b/nginx/ngx_http_js_module.c
@@ -1831,6 +1831,11 @@ ngx_http_js_ext_internal_redirect(njs_vm_t *vm, njs_value_t *args,
return NJS_ERROR;
}
+ if (r->parent != NULL) {
+ njs_vm_error(vm, "internalRedirect cannot be called from a subrequest");
+ return NJS_ERROR;
+ }
+
ctx = ngx_http_get_module_ctx(r, ngx_http_js_module);
if (ngx_http_js_string(vm, njs_arg(args, nargs, 1), &uri) != NJS_OK) {