Welcome! Log In Create A New Profile

Advanced

Re: njs: get raw requestURI or full querystring

Gunter Grodotzki
April 28, 2021 01:46AM
Unfortunately r.args is empty if no key/value pair is given.

> On 28 Apr 2021, at 04:50, Sergey A. Osokin <osa@freebsd.org.ru> wrote:
>
> 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
_______________________________________________
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 149 April 27, 2021 05:22PM

Re: njs: get raw requestURI or full querystring

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

Re: njs: get raw requestURI or full querystring

Gunter Grodotzki 21 April 28, 2021 01:46AM

Re: njs: get raw requestURI or full querystring

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

Re: njs: get raw requestURI or full querystring

Gunter Grodotzki 22 April 28, 2021 09:14AM

Re: njs: get raw requestURI or full querystring

Dmitry Volyntsev 24 April 28, 2021 09:18AM

RE: njs: get raw requestURI or full querystring

Gunter Grodotzki 42 April 28, 2021 10:44AM



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

Online Users

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