]> git.kaiwu.me - nginx.git/commitdiff
Geo: optimized configuration parser.
authorRuslan Ermilov <ru@nginx.com>
Wed, 21 Feb 2018 12:50:43 +0000 (15:50 +0300)
committerRuslan Ermilov <ru@nginx.com>
Wed, 21 Feb 2018 12:50:43 +0000 (15:50 +0300)
If the geo block parser has failed, doing more things is pointless.

src/http/modules/ngx_http_geo_module.c
src/stream/ngx_stream_geo_module.c

index 9102c987d128f6827b8d809adcaa22834062b62c..c11bafa6f658b9dd3ce9d2d64d072c7b245421f3 100644 (file)
@@ -461,6 +461,10 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 
     *cf = save;
 
+    if (rv != NGX_CONF_OK) {
+        goto failed;
+    }
+
     geo->proxies = ctx.proxies;
     geo->proxy_recursive = ctx.proxy_recursive;
 
@@ -555,7 +559,7 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ngx_destroy_pool(ctx.temp_pool);
     ngx_destroy_pool(pool);
 
-    return rv;
+    return NGX_CONF_OK;
 
 failed:
 
index 6b69d9bba4f22fd44b5baf9e5aff9e193aeefe65..b4ad7ef8b3220097e109a4ac8255ce31439d0fde 100644 (file)
@@ -431,6 +431,10 @@ ngx_stream_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 
     *cf = save;
 
+    if (rv != NGX_CONF_OK) {
+        goto failed;
+    }
+
     if (ctx.ranges) {
 
         if (ctx.high.low && !ctx.binary_include) {
@@ -522,7 +526,7 @@ ngx_stream_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ngx_destroy_pool(ctx.temp_pool);
     ngx_destroy_pool(pool);
 
-    return rv;
+    return NGX_CONF_OK;
 
 failed: