Mercurial > hg > nginx-vendor-1-0
comparison src/http/modules/ngx_http_proxy_module.c @ 642:1b80544421e8 NGINX_1_0_11
nginx 1.0.11
*) Change: now double quotes are encoded in an "echo" SSI-command
output.
Thanks to Zaur Abasmirzoev.
*) Feature: the "image_filter_sharpen" directive.
*) Bugfix: a segmentation fault might occur in a worker process if SNI
was used; the bug had appeared in 1.0.9.
*) Bugfix: SIGWINCH signal did not work after first binary upgrade; the
bug had appeared in 1.0.9.
*) Bugfix: the "If-Modified-Since", "If-Range", etc. client request
header lines might be passed to backend while caching; or not passed
without caching if caching was enabled in another part of the
configuration.
*) Bugfix: in the "scgi_param" directive, if complex parameters were
used.
*) Bugfix: "add_header" and "expires" directives did not work if a
request was proxied and response status code was 206.
*) Bugfix: in the "expires @time" directive.
*) Bugfix: in the ngx_http_flv_module.
Thanks to Piotr Sikora.
*) Bugfix: in the ngx_http_mp4_module.
*) Bugfix: nginx could not be built on FreeBSD 10.
*) Bugfix: nginx could not be built on AIX.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 15 Dec 2011 00:00:00 +0400 |
parents | 0d6525917227 |
children | ad25218fd14b |
comparison
equal
deleted
inserted
replaced
641:e21c9e01ce08 | 642:1b80544421e8 |
---|---|
1720 ngx_http_proxy_loc_conf_t *prev = parent; | 1720 ngx_http_proxy_loc_conf_t *prev = parent; |
1721 ngx_http_proxy_loc_conf_t *conf = child; | 1721 ngx_http_proxy_loc_conf_t *conf = child; |
1722 | 1722 |
1723 u_char *p; | 1723 u_char *p; |
1724 size_t size; | 1724 size_t size; |
1725 ngx_keyval_t *s; | |
1726 ngx_hash_init_t hash; | 1725 ngx_hash_init_t hash; |
1727 ngx_http_core_loc_conf_t *clcf; | 1726 ngx_http_core_loc_conf_t *clcf; |
1728 ngx_http_proxy_redirect_t *pr; | 1727 ngx_http_proxy_redirect_t *pr; |
1729 ngx_http_script_compile_t sc; | 1728 ngx_http_script_compile_t sc; |
1730 | 1729 |
2065 sc.complete_values = 1; | 2064 sc.complete_values = 1; |
2066 | 2065 |
2067 if (ngx_http_script_compile(&sc) != NGX_OK) { | 2066 if (ngx_http_script_compile(&sc) != NGX_OK) { |
2068 return NGX_CONF_ERROR; | 2067 return NGX_CONF_ERROR; |
2069 } | 2068 } |
2070 | |
2071 if (conf->headers_source == NULL) { | |
2072 conf->headers_source = ngx_array_create(cf->pool, 4, | |
2073 sizeof(ngx_keyval_t)); | |
2074 if (conf->headers_source == NULL) { | |
2075 return NGX_CONF_ERROR; | |
2076 } | |
2077 } | |
2078 | |
2079 s = ngx_array_push(conf->headers_source); | |
2080 if (s == NULL) { | |
2081 return NGX_CONF_ERROR; | |
2082 } | |
2083 | |
2084 ngx_str_set(&s->key, "Content-Length"); | |
2085 ngx_str_set(&s->value, "$proxy_internal_body_length"); | |
2086 } | 2069 } |
2087 | 2070 |
2088 if (ngx_http_proxy_merge_headers(cf, conf, prev) != NGX_OK) { | 2071 if (ngx_http_proxy_merge_headers(cf, conf, prev) != NGX_OK) { |
2089 return NGX_CONF_ERROR; | 2072 return NGX_CONF_ERROR; |
2090 } | 2073 } |
2099 { | 2082 { |
2100 u_char *p; | 2083 u_char *p; |
2101 size_t size; | 2084 size_t size; |
2102 uintptr_t *code; | 2085 uintptr_t *code; |
2103 ngx_uint_t i; | 2086 ngx_uint_t i; |
2104 ngx_array_t headers_names; | 2087 ngx_array_t headers_names, headers_merged; |
2105 ngx_keyval_t *src, *s, *h; | 2088 ngx_keyval_t *src, *s, *h; |
2106 ngx_hash_key_t *hk; | 2089 ngx_hash_key_t *hk; |
2107 ngx_hash_init_t hash; | 2090 ngx_hash_init_t hash; |
2108 ngx_http_script_compile_t sc; | 2091 ngx_http_script_compile_t sc; |
2109 ngx_http_script_copy_code_t *copy; | 2092 ngx_http_script_copy_code_t *copy; |
2115 conf->headers_set_hash = prev->headers_set_hash; | 2098 conf->headers_set_hash = prev->headers_set_hash; |
2116 conf->headers_source = prev->headers_source; | 2099 conf->headers_source = prev->headers_source; |
2117 } | 2100 } |
2118 | 2101 |
2119 if (conf->headers_set_hash.buckets | 2102 if (conf->headers_set_hash.buckets |
2103 && ((conf->body_source.data == NULL) | |
2104 == (prev->body_source.data == NULL)) | |
2120 #if (NGX_HTTP_CACHE) | 2105 #if (NGX_HTTP_CACHE) |
2121 && ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL)) | 2106 && ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL)) |
2122 #endif | 2107 #endif |
2123 ) | 2108 ) |
2124 { | 2109 { |
2130 != NGX_OK) | 2115 != NGX_OK) |
2131 { | 2116 { |
2132 return NGX_ERROR; | 2117 return NGX_ERROR; |
2133 } | 2118 } |
2134 | 2119 |
2120 if (ngx_array_init(&headers_merged, cf->temp_pool, 4, sizeof(ngx_keyval_t)) | |
2121 != NGX_OK) | |
2122 { | |
2123 return NGX_ERROR; | |
2124 } | |
2125 | |
2135 if (conf->headers_source == NULL) { | 2126 if (conf->headers_source == NULL) { |
2136 conf->headers_source = ngx_array_create(cf->pool, 4, | 2127 conf->headers_source = ngx_array_create(cf->pool, 4, |
2137 sizeof(ngx_keyval_t)); | 2128 sizeof(ngx_keyval_t)); |
2138 if (conf->headers_source == NULL) { | 2129 if (conf->headers_source == NULL) { |
2139 return NGX_ERROR; | 2130 return NGX_ERROR; |
2149 if (conf->headers_set == NULL) { | 2140 if (conf->headers_set == NULL) { |
2150 return NGX_ERROR; | 2141 return NGX_ERROR; |
2151 } | 2142 } |
2152 | 2143 |
2153 | 2144 |
2154 src = conf->headers_source->elts; | |
2155 | |
2156 #if (NGX_HTTP_CACHE) | 2145 #if (NGX_HTTP_CACHE) |
2157 | 2146 |
2158 h = conf->upstream.cache ? ngx_http_proxy_cache_headers: | 2147 h = conf->upstream.cache ? ngx_http_proxy_cache_headers: |
2159 ngx_http_proxy_headers; | 2148 ngx_http_proxy_headers; |
2160 #else | 2149 #else |
2161 | 2150 |
2162 h = ngx_http_proxy_headers; | 2151 h = ngx_http_proxy_headers; |
2163 | 2152 |
2164 #endif | 2153 #endif |
2165 | 2154 |
2155 src = conf->headers_source->elts; | |
2156 for (i = 0; i < conf->headers_source->nelts; i++) { | |
2157 | |
2158 s = ngx_array_push(&headers_merged); | |
2159 if (s == NULL) { | |
2160 return NGX_ERROR; | |
2161 } | |
2162 | |
2163 *s = src[i]; | |
2164 } | |
2165 | |
2166 while (h->key.len) { | 2166 while (h->key.len) { |
2167 | 2167 |
2168 for (i = 0; i < conf->headers_source->nelts; i++) { | 2168 src = headers_merged.elts; |
2169 for (i = 0; i < headers_merged.nelts; i++) { | |
2169 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) { | 2170 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) { |
2170 goto next; | 2171 goto next; |
2171 } | 2172 } |
2172 } | 2173 } |
2173 | 2174 |
2174 s = ngx_array_push(conf->headers_source); | 2175 s = ngx_array_push(&headers_merged); |
2175 if (s == NULL) { | 2176 if (s == NULL) { |
2176 return NGX_ERROR; | 2177 return NGX_ERROR; |
2177 } | 2178 } |
2178 | 2179 |
2179 *s = *h; | 2180 *s = *h; |
2180 | 2181 |
2181 src = conf->headers_source->elts; | |
2182 | |
2183 next: | 2182 next: |
2184 | 2183 |
2185 h++; | 2184 h++; |
2186 } | 2185 } |
2187 | 2186 |
2188 | 2187 if (conf->body_source.data) { |
2189 src = conf->headers_source->elts; | 2188 s = ngx_array_push(&headers_merged); |
2190 for (i = 0; i < conf->headers_source->nelts; i++) { | 2189 if (s == NULL) { |
2190 return NGX_ERROR; | |
2191 } | |
2192 | |
2193 ngx_str_set(&s->key, "Content-Length"); | |
2194 ngx_str_set(&s->value, "$proxy_internal_body_length"); | |
2195 } | |
2196 | |
2197 | |
2198 src = headers_merged.elts; | |
2199 for (i = 0; i < headers_merged.nelts; i++) { | |
2191 | 2200 |
2192 hk = ngx_array_push(&headers_names); | 2201 hk = ngx_array_push(&headers_names); |
2193 if (hk == NULL) { | 2202 if (hk == NULL) { |
2194 return NGX_ERROR; | 2203 return NGX_ERROR; |
2195 } | 2204 } |