comparison src/http/modules/ngx_http_fastcgi_module.c @ 5938:cd2abf7e7740

Upstream: fixed unexpected inheritance into limit_except blocks. The proxy_pass directive and other handlers are not expected to be inherited into nested locations, but there is a special code to inherit upstream handlers into limit_except blocks, as well as a configuration into if{} blocks. This caused incorrect behaviour in configurations with nested locations and limit_except blocks, like this: location / { proxy_pass http://u; location /inner/ { # no proxy_pass here limit_except GET { # nothing } } } In such a configuration the limit_except block inside "location /inner/" unexpectedly used proxy_pass defined in "location /", while it shouldn't. Fix is to avoid inheritance of conf->upstream.upstream (and conf->proxy_lengths) into locations which don't have noname flag.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 09 Dec 2014 18:22:31 +0300
parents 5b9f711dc819
children e3b3b89d74e8
comparison
equal deleted inserted replaced
5937:5b9f711dc819 5938:cd2abf7e7740
2695 != NGX_OK) 2695 != NGX_OK)
2696 { 2696 {
2697 return NGX_CONF_ERROR; 2697 return NGX_CONF_ERROR;
2698 } 2698 }
2699 2699
2700 if (conf->upstream.upstream == NULL && conf->fastcgi_lengths == NULL) { 2700 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
2701
2702 if (clcf->noname
2703 && conf->upstream.upstream == NULL && conf->fastcgi_lengths == NULL)
2704 {
2701 conf->upstream.upstream = prev->upstream.upstream; 2705 conf->upstream.upstream = prev->upstream.upstream;
2702 conf->fastcgi_lengths = prev->fastcgi_lengths; 2706 conf->fastcgi_lengths = prev->fastcgi_lengths;
2703 conf->fastcgi_values = prev->fastcgi_values; 2707 conf->fastcgi_values = prev->fastcgi_values;
2704 } 2708 }
2705 2709
2706 if (conf->upstream.upstream || conf->fastcgi_lengths) { 2710 if (clcf->lmt_excpt && clcf->handler == NULL
2707 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); 2711 && (conf->upstream.upstream || conf->fastcgi_lengths))
2708 if (clcf->handler == NULL && clcf->lmt_excpt) { 2712 {
2709 clcf->handler = ngx_http_fastcgi_handler; 2713 clcf->handler = ngx_http_fastcgi_handler;
2710 }
2711 } 2714 }
2712 2715
2713 #if (NGX_PCRE) 2716 #if (NGX_PCRE)
2714 if (conf->split_regex == NULL) { 2717 if (conf->split_regex == NULL) {
2715 conf->split_regex = prev->split_regex; 2718 conf->split_regex = prev->split_regex;