[Patch] Re: Directive "map" not working with regex key and value that like "$1"

kindy kindy61 at gmail.com
Sun Dec 21 03:03:24 UTC 2014


The root cause there are both. var_values & value_hashs.
when used with regex key, we should not use var_values,
because numbered capture are not registered as nginx variable.

so directive like "~(.+) $1;" will add $1 into var_values by mistake, but
latter regex will not add this variable..


---start of patch---

--- nginx-1.1.19-orig/src/http/modules/ngx_http_map_module.c 2012-01-18
23:07:43.000000000 +0800
+++ nginx-1.1.19-fixe/src/http/modules/ngx_http_map_module.c 2014-12-20
10:42:01.000000000 +0800
@@ -403,6 +403,10 @@
         return ngx_conf_parse(cf, &file);
     }

+#if (NGX_PCRE)
+    if (!value[0].len || value[0].data[0] != '~') {
+#endif
+
     if (value[1].data[0] == '$') {
         name = value[1];
         name.len--;
@@ -442,6 +446,10 @@
         goto found;
     }

+#if (NGX_PCRE)
+    }
+#endif
+
     key = 0;

     for (i = 0; i < value[1].len; i++) {


---end of patch---


On Fri, Dec 19, 2014 at 7:59 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:

> Hello!
>
> On Fri, Dec 19, 2014 at 07:23:14AM +0800, Kindy Lin wrote:
>
> > Yep, it's a bug but not a question.
>
> Even if you think it's a bug (I don't, rather a feature request),
> it's still doesn't belong to the development list unless you are
> providing a patch or asking where to start hacking.
>
> Thank you.
>
> --
> Maxim Dounin
> http://nginx.org/
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>



-- 
- - - - - - - - - - - -
林青(Kindy Lin)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20141221/63396b57/attachment.html>


More information about the nginx-devel mailing list