Welcome! Log In Create A New Profile

Advanced

[njs] HTTP: improved r.parent property handler.

Dmitry Volyntsev
November 26, 2019 06:16AM
details: https://hg.nginx.org/njs/rev/851550b92d9d
branches:
changeset: 1257:851550b92d9d
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Mon Nov 25 17:54:58 2019 +0300
description:
HTTP: improved r.parent property handler.

Previously, r.parent handler threw an exception if it was called not for
a subrequest. This is too restrictive, as it prevents any iterations
over all r properties (for example: JSON.stringify()).

Instead, "undefined" value is returned as it is already done for
r.requestBody when request body is unavailable.

diffstat:

nginx/ngx_http_js_module.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diffs (14 lines):

diff -r 790caa744e0e -r 851550b92d9d nginx/ngx_http_js_module.c
--- a/nginx/ngx_http_js_module.c Mon Nov 25 17:53:32 2019 +0300
+++ b/nginx/ngx_http_js_module.c Mon Nov 25 17:54:58 2019 +0300
@@ -2091,8 +2091,8 @@ ngx_http_js_ext_get_parent(njs_vm_t *vm,
: NULL;

if (ctx == NULL || ctx->vm != vm) {
- njs_vm_error(vm, "parent can only be returned for a subrequest");
- return NJS_ERROR;
+ njs_value_undefined_set(value);
+ return NJS_OK;
}

njs_value_assign(value, njs_value_arg(&ctx->request));
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] HTTP: improved r.parent property handler.

Dmitry Volyntsev 78 November 26, 2019 06:16AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready