aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2014-12-09 18:21:55 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2014-12-09 18:21:55 +0300
commitc863e1b3b56e647b9cc9c9aeed53a9ab309194ed (patch)
treea93d708bb96b5183047dabcb367a0deeada2a631 /src
parent88ed2d39afcc00d46a640de542f6b491413e38d6 (diff)
downloadnginx-c863e1b3b56e647b9cc9c9aeed53a9ab309194ed.tar.gz
nginx-c863e1b3b56e647b9cc9c9aeed53a9ab309194ed.zip
Upstream: inheritance of proxy_pass and friends (ticket #645).
Instead of independant inheritance of conf->upstream.upstream (proxy_pass without variables) and conf->proxy_lengths (proxy_pass with variables) we now test them both and inherit only if neither is set. Additionally, SSL context is also inherited only in this case now. Based on the patch by Alexey Radkov.
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c5
-rw-r--r--src/http/modules/ngx_http_proxy_module.c14
-rw-r--r--src/http/modules/ngx_http_scgi_module.c5
-rw-r--r--src/http/modules/ngx_http_uwsgi_module.c12
4 files changed, 12 insertions, 24 deletions
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index cc93570b1..2ab40fbfd 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -2697,11 +2697,8 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}
- if (conf->upstream.upstream == NULL) {
+ if (conf->upstream.upstream == NULL && conf->fastcgi_lengths == NULL) {
conf->upstream.upstream = prev->upstream.upstream;
- }
-
- if (conf->fastcgi_lengths == NULL) {
conf->fastcgi_lengths = prev->fastcgi_lengths;
conf->fastcgi_values = prev->fastcgi_values;
}
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index 78961babd..9ac86c003 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -2968,12 +2968,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_ptr_value(conf->cookie_paths, prev->cookie_paths, NULL);
-#if (NGX_HTTP_SSL)
- if (conf->upstream.ssl == NULL) {
- conf->upstream.ssl = prev->upstream.ssl;
- }
-#endif
-
ngx_conf_merge_uint_value(conf->http_version, prev->http_version,
NGX_HTTP_VERSION_10);
@@ -2997,14 +2991,16 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}
- if (conf->upstream.upstream == NULL) {
+ if (conf->upstream.upstream == NULL && conf->proxy_lengths == NULL) {
conf->upstream.upstream = prev->upstream.upstream;
conf->vars = prev->vars;
- }
- if (conf->proxy_lengths == NULL) {
conf->proxy_lengths = prev->proxy_lengths;
conf->proxy_values = prev->proxy_values;
+
+#if (NGX_HTTP_SSL)
+ conf->upstream.ssl = prev->upstream.ssl;
+#endif
}
if (conf->upstream.upstream || conf->proxy_lengths) {
diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
index 53a90d99a..49735bfde 100644
--- a/src/http/modules/ngx_http_scgi_module.c
+++ b/src/http/modules/ngx_http_scgi_module.c
@@ -1443,11 +1443,8 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}
- if (conf->upstream.upstream == NULL) {
+ if (conf->upstream.upstream == NULL && conf->scgi_lengths == NULL) {
conf->upstream.upstream = prev->upstream.upstream;
- }
-
- if (conf->scgi_lengths == NULL) {
conf->scgi_lengths = prev->scgi_lengths;
conf->scgi_values = prev->scgi_values;
}
diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
index d12fbdf7b..0dbcbf16a 100644
--- a/src/http/modules/ngx_http_uwsgi_module.c
+++ b/src/http/modules/ngx_http_uwsgi_module.c
@@ -1683,10 +1683,6 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}
- if (conf->upstream.ssl == NULL) {
- conf->upstream.ssl = prev->upstream.ssl;
- }
-
#endif
ngx_conf_merge_str_value(conf->uwsgi_string, prev->uwsgi_string, "");
@@ -1702,13 +1698,15 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR;
}
- if (conf->upstream.upstream == NULL) {
+ if (conf->upstream.upstream == NULL && conf->uwsgi_lengths == NULL) {
conf->upstream.upstream = prev->upstream.upstream;
- }
- if (conf->uwsgi_lengths == NULL) {
conf->uwsgi_lengths = prev->uwsgi_lengths;
conf->uwsgi_values = prev->uwsgi_values;
+
+#if (NGX_HTTP_SSL)
+ conf->upstream.ssl = prev->upstream.ssl;
+#endif
}
if (conf->upstream.upstream || conf->uwsgi_lengths) {