Welcome! Log In Create A New Profile

Advanced

[PATCH 2 of 5] Fixed proxy_set_header inheritance with proxy_set_body

Maxim Dounin
November 10, 2011 06:20PM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1320965912 -10800
# Node ID de56bca2d2e849444f52655c87b2e99c10c42f4a
# Parent 3a36355f93db9030e7a39427a9e68cc1b6431044
Fixed proxy_set_header inheritance with proxy_set_body.

diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -2493,7 +2493,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t

u_char *p;
size_t size;
- ngx_keyval_t *s;
ngx_hash_init_t hash;
ngx_http_core_loc_conf_t *clcf;
ngx_http_proxy_redirect_t *pr;
@@ -2841,22 +2840,6 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
if (ngx_http_script_compile(&sc) != NGX_OK) {
return NGX_CONF_ERROR;
}
-
- if (conf->headers_source == NULL) {
- conf->headers_source = ngx_array_create(cf->pool, 4,
- sizeof(ngx_keyval_t));
- if (conf->headers_source == NULL) {
- return NGX_CONF_ERROR;
- }
- }
-
- s = ngx_array_push(conf->headers_source);
- if (s == NULL) {
- return NGX_CONF_ERROR;
- }
-
- ngx_str_set(&s->key, "Content-Length");
- ngx_str_set(&s->value, "$proxy_internal_body_length");
}

if (ngx_http_proxy_merge_headers(cf, conf, prev) != NGX_OK) {
@@ -2891,6 +2874,8 @@ ngx_http_proxy_merge_headers(ngx_conf_t
}

if (conf->headers_set_hash.buckets
+ && ((conf->body_source.data == NULL)
+ == (prev->body_source.data == NULL))
#if (NGX_HTTP_CACHE)
&& ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL))
#endif
@@ -2973,6 +2958,16 @@ ngx_http_proxy_merge_headers(ngx_conf_t
h++;
}

+ if (conf->body_source.data) {
+ s = ngx_array_push(&headers_merged);
+ if (s == NULL) {
+ return NGX_ERROR;
+ }
+
+ ngx_str_set(&s->key, "Content-Length");
+ ngx_str_set(&s->value, "$proxy_internal_body_length");
+ }
+

src = headers_merged.elts;
for (i = 0; i < headers_merged.nelts; i++) {

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 0 of 5] ticket #45 related fixes

Maxim Dounin 1604 November 10, 2011 06:20PM

[PATCH 1 of 5] Fixed proxy_set_header inheritance with proxy_cache (ticket #45)

Maxim Dounin 620 November 10, 2011 06:20PM

[PATCH 2 of 5] Fixed proxy_set_header inheritance with proxy_set_body

Maxim Dounin 575 November 10, 2011 06:20PM

[PATCH 3 of 5] Fixed Upgrade header clearing with proxy_cache

Maxim Dounin 477 November 10, 2011 06:20PM

[PATCH 4 of 5] Separate functions to merge fastcgi/scgi/uwsgi params

Maxim Dounin 814 November 10, 2011 06:20PM

[PATCH 5 of 5] Fixed fastcgi/scgi/uwsgi_param inheritance

Maxim Dounin 696 November 10, 2011 06:20PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 206
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready