Sergey A. Osokin
April 27, 2021 10:52PM
Hi Gunter,

hope you're doing well these days.

On Tue, Apr 27, 2021 at 11:21:26PM +0200, Gunter Grodotzki wrote:
> Hi all,
>
> I would love to try out nginx njs for https://url.rw
>
> Unfortunately I do not seem to be able to get the value of the querystring e.g.
> in my case it does not contain any key-value pairs:
>
> https://url.rw/?https%3A%2F%2Flifeofguenter.de
>
> I am interested in the value “https%3A%2F%2Flifeofguenter.de” (well ideally
> urldecoded).

According to https://nginx.org/en/docs/njs/reference.html#http, the HTTP
request object has arguments:

r.args{}
request arguments object, read-only

It's possible to get an argument with the following example:

for (var arg in r.args) {
if (arg != '') {
str += arg;
break;
}
}

The str can be unescaped then with the following function,
http://nginx.org/en/docs/njs/reference.html#querystring_unescape

querystring.unescape(string)

Performs decoding of URL percent-encoded characters of the string,
returns an unescaped query string.


Hope that helps.

--
Sergey Osokin
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

njs: get raw requestURI or full querystring

Gunter Grodotzki 391 April 27, 2021 05:22PM

Re: njs: get raw requestURI or full querystring

Sergey A. Osokin 127 April 27, 2021 10:52PM

Re: njs: get raw requestURI or full querystring

Gunter Grodotzki 104 April 28, 2021 01:46AM

Re: njs: get raw requestURI or full querystring

Sergey A. Osokin 119 April 28, 2021 08:18AM

Re: njs: get raw requestURI or full querystring

Gunter Grodotzki 106 April 28, 2021 09:14AM

Re: njs: get raw requestURI or full querystring

Dmitry Volyntsev 119 April 28, 2021 09:18AM

RE: njs: get raw requestURI or full querystring

Gunter Grodotzki 153 April 28, 2021 10:44AM



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

Online Users

Guests: 182
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