Welcome! Log In Create A New Profile

Advanced

Re: accessing $arg_PARAMETER for parameter with . in it

Maxim Dounin
July 11, 2012 03:16PM
Hello!

On Wed, Jul 11, 2012 at 01:39:19AM -0400, bluesmoon wrote:

> Hi,
>
> I have a query string parameter that has a dot in it. For example,
> `a.b`. I need to write this parameter to my log file. How do I
> reference it?
>
> I've tried `$arg_a.b` but that prints `-.b` (ie, it prints the value of
> $arg_a which is - followed by .b)
>
> I've also tried `$arg_a_b` but that just prints `-` since there is no
> parameter a_b or a-b.
>
> What should I do?

The $arg_* variables won't allow you to access request arguments with
characters not allowed in variable names.

If you really need to, you may parse $args yourself, e.g. with
map{} directive using regular expressions. Something like this
should work:

map $args $ab {
"~(?:^|[&;])a[.]b=(?<foo>[^&;]*)" $foo;
}

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

accessing $arg_PARAMETER for parameter with . in it

bluesmoon July 11, 2012 01:39AM

Re: accessing $arg_PARAMETER for parameter with . in it

bluesmoon July 11, 2012 12:48PM

Re: accessing $arg_PARAMETER for parameter with . in it

Maxim Dounin July 11, 2012 03:16PM

Re: accessing $arg_PARAMETER for parameter with . in it

bluesmoon July 11, 2012 04:34PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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