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

Mark Ellis m at rkellis.com
Wed Aug 2 11:30:11 UTC 2017


# 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;


More information about the nginx-devel mailing list