]> git.kaiwu.me - nginx.git/commitdiff
Geo: ensure that default entry is always present.
authorRuslan Ermilov <ru@nginx.com>
Fri, 21 Dec 2012 08:46:52 +0000 (08:46 +0000)
committerRuslan Ermilov <ru@nginx.com>
Fri, 21 Dec 2012 08:46:52 +0000 (08:46 +0000)
If 0.0.0.0/32 entry was present and there was no explicit "default",
we failed to add an empty string as a default value.

src/http/modules/ngx_http_geo_module.c

index 24091bf719228a0403b98ed1584b316e0067159e..26f4e577a503a9ad96a11091699e4986605f65d4 100644 (file)
@@ -453,16 +453,14 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
         ngx_destroy_pool(ctx.temp_pool);
         ngx_destroy_pool(pool);
 
-        if (ngx_radix32tree_find(ctx.tree, 0) != NGX_RADIX_NO_VALUE) {
-            return rv;
-        }
-
         if (ngx_radix32tree_insert(ctx.tree, 0, 0,
                                    (uintptr_t) &ngx_http_variable_null_value)
             == NGX_ERROR)
         {
             return NGX_CONF_ERROR;
         }
+
+        /* NGX_BUSY is okay (default was set explicitly) */
     }
 
     return rv;