[PATCH] Allows hyphens in variable names so can access hyphenated query vars

2017-08-02 Thread Mark Ellis via nginx-devel
# HG changeset patch
# User Mark Ellis 
# 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.cTue Aug 01 19:12:10 2017 +0300
+++ b/src/http/ngx_http_script.cWed 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;
___
nginx-devel mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-devel


Re: [PATCH] Allows hyphens in variable names so can access hyphenated query vars

2017-08-07 Thread Mark Ellis via nginx-devel
Ok. How would you suggest accessing query parameters with hyphens?

e.g. `?foo-bar=123`

how would you get the value of foo-bar?

Thanks

On Mon, 7 Aug 2017, at 02:20 PM, Maxim Dounin wrote:
> Hello!
> 
> On Wed, Aug 02, 2017 at 11:30:11AM +0000, Mark Ellis via nginx-devel
> wrote:
> 
> > # HG changeset patch
> > # User Mark Ellis 
> > # 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.cTue Aug 01 19:12:10 2017 +0300
> > +++ b/src/http/ngx_http_script.cWed 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/
___
nginx-devel mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx-devel