aris
1
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?
Posted at Nginx Forum:
I’ve also tried ${arg_a.b} and nginx -t tells me that the closing
bracket in “arg_a” variable is missing
Posted at Nginx Forum:
Hello!
On Wed, Jul 11, 2012 at 01:39:19AM -0400, bluesmoon wrote:
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 D.