Welcome! Log In Create A New Profile

Advanced

Re: NJS Questions and/or Bugs

Dmitry Volyntsev
August 12, 2021 02:16AM
Hi Lance,

Thanks for your detailed feedback.

>What exactly should r.variables and r.rawVariables contain?  ...

r.variables and r.rawVariables are special objects, because they are
created on the fly. There is no way to get all the possible variable
names from nginx. So Object.keys(r.variables) is empty list. Therefore
dumping and iterating over r.variables returns nothing. But, if you have
a $foo variable, r.variables.foo would return the $foo content as a string.

> That might also be a fallacy of our testing methodology since we’re
using JSON.stringify to visualize the output in the browser.

The JSON.stringify() is no the best, use njs.dump().
http://nginx.org/en/docs/njs/reference.html#njs

>Is there already an NJS object or are there plans for an object that
parses and maps POST key/value pairs into a JSON object?

Take a look at https://github.com/nginx/njs/issues/48#issuecomment-415745451

>Filters for the different phase of the Nginx request

We are thinking about the adding phases handlers.

>Direct variable access to the Nginx variables (either read only or
writable depending on the context within which they were created)

this is already in place

>Array like access to the request arguments (e.g. cookies, post args,
query string args, etc).  Right now the only version of this that we’ve
found reliably working in the js_content phase is query string related
stuff (in the args array)

Feel free to add a feature request here https://github.com/nginx/njs
Although this is not a feature requested often (for some reason).
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

NJS Questions and/or Bugs

Lance Dockins August 11, 2021 08:44PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 09:52PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 10:06PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 10:22PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 10:32PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 10:40PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 10:44PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 10:50PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 10:58PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 11:02PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 11:46PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 11:52PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 10:42PM

Re: NJS Questions and/or Bugs

Dmitry Volyntsev August 12, 2021 02:16AM

Re: NJS Questions and/or Bugs

Lance Dockins August 12, 2021 08:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 212
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready