[nginx] svn commit: r4786 - in branches/stable-1.2: . src/http/modules

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Aug 6 14:04:06 UTC 2012


Author: mdounin
Date: 2012-08-06 14:04:06 +0000 (Mon, 06 Aug 2012)
New Revision: 4786
URL: http://trac.nginx.org/nginx/changeset/4786/nginx

Log:
Merge of r4713: map hostnames fix (ticket #182).

The final dot wasn't stripped before looking up in a map of hostnames.


Modified:
   branches/stable-1.2/
   branches/stable-1.2/src/http/modules/ngx_http_map_module.c

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-08-06 10:48:09 UTC (rev 4785)
+++ branches/stable-1.2	2012-08-06 14:04:06 UTC (rev 4786)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713
\ No newline at end of property
Modified: branches/stable-1.2/src/http/modules/ngx_http_map_module.c
===================================================================
--- branches/stable-1.2/src/http/modules/ngx_http_map_module.c	2012-08-06 10:48:09 UTC (rev 4785)
+++ branches/stable-1.2/src/http/modules/ngx_http_map_module.c	2012-08-06 14:04:06 UTC (rev 4786)
@@ -110,7 +110,6 @@
 {
     ngx_http_map_ctx_t  *map = (ngx_http_map_ctx_t *) data;
 
-    size_t                      len;
     ngx_str_t                   val;
     ngx_http_variable_value_t  *value;
 
@@ -121,10 +120,8 @@
         return NGX_ERROR;
     }
 
-    len = val.len;
-
-    if (len && map->hostnames && val.data[len - 1] == '.') {
-        len--;
+    if (map->hostnames && val.len > 0 && val.data[val.len - 1] == '.') {
+        val.len--;
     }
 
     value = ngx_http_map_find(r, &map->map, &val);
@@ -281,6 +278,8 @@
     map->default_value = ctx.default_value ? ctx.default_value:
                                              &ngx_http_variable_null_value;
 
+    map->hostnames = ctx.hostnames;
+
     hash.key = ngx_hash_key_lc;
     hash.max_size = mcf->hash_max_size;
     hash.bucket_size = mcf->hash_bucket_size;



More information about the nginx-devel mailing list