]> git.kaiwu.me - nginx.git/commitdiff
Upstream keepalive: detect duplicate "keepalive" directive.
authorRuslan Ermilov <ru@nginx.com>
Wed, 26 Dec 2012 14:46:06 +0000 (14:46 +0000)
committerRuslan Ermilov <ru@nginx.com>
Wed, 26 Dec 2012 14:46:06 +0000 (14:46 +0000)
A failure to detect duplicate "keepalive" directive resulted in
stack exhaustion.

src/http/modules/ngx_http_upstream_keepalive_module.c

index d10e3d016cb071794520f5f55c48e8f2d0aa69b2..a2ad5aa8d952f401df615fd79edb8fa56cb35a27 100644 (file)
@@ -502,6 +502,10 @@ ngx_http_upstream_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     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;