comparison 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
comparison
equal deleted inserted replaced
4997:5d1d3b2acb1d 4998:82336a9ce26d
500 uscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_module); 500 uscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_module);
501 501
502 kcf = ngx_http_conf_upstream_srv_conf(uscf, 502 kcf = ngx_http_conf_upstream_srv_conf(uscf,
503 ngx_http_upstream_keepalive_module); 503 ngx_http_upstream_keepalive_module);
504 504
505 if (kcf->original_init_upstream) {
506 return "is duplicate";
507 }
508
505 kcf->original_init_upstream = uscf->peer.init_upstream 509 kcf->original_init_upstream = uscf->peer.init_upstream
506 ? uscf->peer.init_upstream 510 ? uscf->peer.init_upstream
507 : ngx_http_upstream_init_round_robin; 511 : ngx_http_upstream_init_round_robin;
508 512
509 uscf->peer.init_upstream = ngx_http_upstream_init_keepalive; 513 uscf->peer.init_upstream = ngx_http_upstream_init_keepalive;