[PATCH] Allows hyphens in variable names so can access hyphenated query vars
Maxim Dounin
mdounin at mdounin.ru
Mon Aug 7 13:20:49 UTC 2017
Hello!
On Wed, Aug 02, 2017 at 11:30:11AM +0000, Mark Ellis via nginx-devel wrote:
> # HG changeset patch
> # User Mark Ellis <m at rkellis.com>
> # Date 1501670303 -3600
> # Wed Aug 02 11:38:23 2017 +0100
> # Node ID 08008b0d1f4ffbd017d9f50142bdd46d7c4a41d2
> # Parent 1eb753aa8e5e9ee5059ebb544194c8919b674873
> Allows hyphens in variable names so can access hyphenated query vars
>
> This patch allows hyphens in variable names so that you can access query string
> parameters with hyphens
>
> Before if you had a query string param such as `?foo-bar=123` you could not
> access it with the variable `$foo-bar` as variables could not contain hyphens.
>
> diff -r 1eb753aa8e5e -r 08008b0d1f4f src/http/ngx_http_script.c
> --- a/src/http/ngx_http_script.c Tue Aug 01 19:12:10 2017 +0300
> +++ b/src/http/ngx_http_script.c Wed Aug 02 11:38:23 2017 +0100
> @@ -403,6 +403,7 @@
> if ((ch >= 'A' && ch <= 'Z')
> || (ch >= 'a' && ch <= 'z')
> || (ch >= '0' && ch <= '9')
> + || ch == '-'
> || ch == '_')
> {
> continue;
No, thanks. Such a change will break a lot of configs, not to
mention it is counter-intuitive and contradicts how things usually
work in other programming languages.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list