diff src/http/modules/ngx_http_upstream_keepalive_module.c @ 4998:82336a9ce26d

Upstream keepalive: detect duplicate "keepalive" directive. A failure to detect duplicate "keepalive" directive resulted in stack exhaustion.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 26 Dec 2012 14:46:06 +0000
parents 5b5c07dee156
children 089a662c17d1
line wrap: on
line diff
--- a/src/http/modules/ngx_http_upstream_keepalive_module.c
+++ b/src/http/modules/ngx_http_upstream_keepalive_module.c
@@ -502,6 +502,10 @@ ngx_http_upstream_keepalive(ngx_conf_t *
     kcf = ngx_http_conf_upstream_srv_conf(uscf,
                                           ngx_http_upstream_keepalive_module);
 
+    if (kcf->original_init_upstream) {
+        return "is duplicate";
+    }
+
     kcf->original_init_upstream = uscf->peer.init_upstream
                                   ? uscf->peer.init_upstream
                                   : ngx_http_upstream_init_round_robin;