Mercurial > hg > nginx
comparison src/http/modules/ngx_http_uwsgi_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 |
---|---|
1696 != NGX_OK) | 1696 != NGX_OK) |
1697 { | 1697 { |
1698 return NGX_CONF_ERROR; | 1698 return NGX_CONF_ERROR; |
1699 } | 1699 } |
1700 | 1700 |
1701 if (conf->upstream.upstream == NULL && conf->uwsgi_lengths == NULL) { | 1701 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
1702 | |
1703 if (clcf->noname | |
1704 && conf->upstream.upstream == NULL && conf->uwsgi_lengths == NULL) | |
1705 { | |
1702 conf->upstream.upstream = prev->upstream.upstream; | 1706 conf->upstream.upstream = prev->upstream.upstream; |
1703 | 1707 |
1704 conf->uwsgi_lengths = prev->uwsgi_lengths; | 1708 conf->uwsgi_lengths = prev->uwsgi_lengths; |
1705 conf->uwsgi_values = prev->uwsgi_values; | 1709 conf->uwsgi_values = prev->uwsgi_values; |
1706 | 1710 |
1707 #if (NGX_HTTP_SSL) | 1711 #if (NGX_HTTP_SSL) |
1708 conf->upstream.ssl = prev->upstream.ssl; | 1712 conf->upstream.ssl = prev->upstream.ssl; |
1709 #endif | 1713 #endif |
1710 } | 1714 } |
1711 | 1715 |
1712 if (conf->upstream.upstream || conf->uwsgi_lengths) { | 1716 if (clcf->lmt_excpt && clcf->handler == NULL |
1713 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); | 1717 && (conf->upstream.upstream || conf->uwsgi_lengths)) |
1714 if (clcf->handler == NULL && clcf->lmt_excpt) { | 1718 { |
1715 clcf->handler = ngx_http_uwsgi_handler; | 1719 clcf->handler = ngx_http_uwsgi_handler; |
1716 } | |
1717 } | 1720 } |
1718 | 1721 |
1719 ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0); | 1722 ngx_conf_merge_uint_value(conf->modifier1, prev->modifier1, 0); |
1720 ngx_conf_merge_uint_value(conf->modifier2, prev->modifier2, 0); | 1723 ngx_conf_merge_uint_value(conf->modifier2, prev->modifier2, 0); |
1721 | 1724 |