comparison src/http/modules/ngx_http_proxy_module.c @ 480:549994537f15 NGINX_0_7_52

nginx 0.7.52 *) Feature: the first native Windows binary release. *) Bugfix: in processing HEAD method while caching. *) Bugfix: in processing the "If-Modified-Since", "If-Range", etc. client request header lines while caching. *) Bugfix: now the "Set-Cookie" and "P3P" header lines are hidden in cacheable responses. *) Bugfix: if nginx was built with the ngx_http_perl_module and with a perl which supports threads, then during a master process exit the message "panic: MUTEX_LOCK" might be issued. *) Bugfix: nginx could not be built --without-http-cache; the bug had appeared in 0.7.48. *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc, and ppc; the bug had appeared in 0.7.42.
author Igor Sysoev <http://sysoev.ru>
date Mon, 20 Apr 2009 00:00:00 +0400
parents 09f0ef15d544
children 392c16f2d858
comparison
equal deleted inserted replaced
479:eb4fdebda673 480:549994537f15
493 ngx_string("X-Accel-Limit-Rate"), 493 ngx_string("X-Accel-Limit-Rate"),
494 ngx_string("X-Accel-Buffering"), 494 ngx_string("X-Accel-Buffering"),
495 ngx_string("X-Accel-Charset"), 495 ngx_string("X-Accel-Charset"),
496 ngx_null_string 496 ngx_null_string
497 }; 497 };
498
499
500 #if (NGX_HTTP_CACHE)
501
502 static ngx_keyval_t ngx_http_proxy_cache_headers[] = {
503 { ngx_string("Host"), ngx_string("$proxy_host") },
504 { ngx_string("Connection"), ngx_string("close") },
505 { ngx_string("Keep-Alive"), ngx_string("") },
506 { ngx_string("Expect"), ngx_string("") },
507 { ngx_string("If-Modified-Since"), ngx_string("") },
508 { ngx_string("If-Unmodified-Since"), ngx_string("") },
509 { ngx_string("If-Match-None"), ngx_string("") },
510 { ngx_string("If-Match"), ngx_string("") },
511 { ngx_string("Range"), ngx_string("") },
512 { ngx_string("If-Range"), ngx_string("") },
513 { ngx_null_string, ngx_null_string }
514 };
515
516
517 static ngx_str_t ngx_http_proxy_hide_cache_headers[] = {
518 ngx_string("Date"),
519 ngx_string("Server"),
520 ngx_string("X-Pad"),
521 ngx_string("X-Accel-Expires"),
522 ngx_string("X-Accel-Redirect"),
523 ngx_string("X-Accel-Limit-Rate"),
524 ngx_string("X-Accel-Buffering"),
525 ngx_string("X-Accel-Charset"),
526 ngx_string("Set-Cookie"),
527 ngx_string("P3P"),
528 ngx_null_string
529 };
530
531 #endif
498 532
499 533
500 static ngx_http_variable_t ngx_http_proxy_vars[] = { 534 static ngx_http_variable_t ngx_http_proxy_vars[] = {
501 535
502 { ngx_string("proxy_host"), NULL, ngx_http_proxy_host_variable, 0, 536 { ngx_string("proxy_host"), NULL, ngx_http_proxy_host_variable, 0,
1904 { 1938 {
1905 ngx_http_proxy_loc_conf_t *prev = parent; 1939 ngx_http_proxy_loc_conf_t *prev = parent;
1906 ngx_http_proxy_loc_conf_t *conf = child; 1940 ngx_http_proxy_loc_conf_t *conf = child;
1907 1941
1908 size_t size; 1942 size_t size;
1943 ngx_str_t *h;
1909 ngx_keyval_t *s; 1944 ngx_keyval_t *s;
1910 ngx_hash_init_t hash; 1945 ngx_hash_init_t hash;
1911 ngx_http_proxy_redirect_t *pr; 1946 ngx_http_proxy_redirect_t *pr;
1912 ngx_http_script_compile_t sc; 1947 ngx_http_script_compile_t sc;
1913 1948
2067 2102
2068 shm_zone = conf->upstream.cache; 2103 shm_zone = conf->upstream.cache;
2069 2104
2070 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2105 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2071 "\"proxy_cache\" zone \"%V\" is unknown", 2106 "\"proxy_cache\" zone \"%V\" is unknown",
2072 &shm_zone->name); 2107 &shm_zone->shm.name);
2073 2108
2074 return NGX_CONF_ERROR; 2109 return NGX_CONF_ERROR;
2075 } 2110 }
2076 2111
2077 ngx_conf_merge_uint_value(conf->upstream.cache_min_uses, 2112 ngx_conf_merge_uint_value(conf->upstream.cache_min_uses,
2168 2203
2169 hash.max_size = conf->headers_hash_max_size; 2204 hash.max_size = conf->headers_hash_max_size;
2170 hash.bucket_size = conf->headers_hash_bucket_size; 2205 hash.bucket_size = conf->headers_hash_bucket_size;
2171 hash.name = "proxy_headers_hash"; 2206 hash.name = "proxy_headers_hash";
2172 2207
2208 #if (NGX_HTTP_CACHE)
2209
2210 h = conf->upstream.cache ? ngx_http_proxy_hide_cache_headers:
2211 ngx_http_proxy_hide_headers;
2212 #else
2213
2214 h = ngx_http_proxy_hide_headers;
2215
2216 #endif
2217
2173 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream, 2218 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
2174 &prev->upstream, 2219 &prev->upstream, h, &hash)
2175 ngx_http_proxy_hide_headers, &hash)
2176 != NGX_OK) 2220 != NGX_OK)
2177 { 2221 {
2178 return NGX_CONF_ERROR; 2222 return NGX_CONF_ERROR;
2179 } 2223 }
2180 2224
2284 } 2328 }
2285 2329
2286 2330
2287 src = conf->headers_source->elts; 2331 src = conf->headers_source->elts;
2288 2332
2289 for (h = ngx_http_proxy_headers; h->key.len; h++) { 2333 #if (NGX_HTTP_CACHE)
2334
2335 h = conf->upstream.cache ? ngx_http_proxy_cache_headers:
2336 ngx_http_proxy_headers;
2337 #else
2338
2339 h = ngx_http_proxy_headers;
2340
2341 #endif
2342
2343 while (h->key.len) {
2290 2344
2291 for (i = 0; i < conf->headers_source->nelts; i++) { 2345 for (i = 0; i < conf->headers_source->nelts; i++) {
2292 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) { 2346 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) {
2293 goto next; 2347 goto next;
2294 } 2348 }
2303 2357
2304 src = conf->headers_source->elts; 2358 src = conf->headers_source->elts;
2305 2359
2306 next: 2360 next:
2307 2361
2308 continue; 2362 h++;
2309 } 2363 }
2310 2364
2311 2365
2312 src = conf->headers_source->elts; 2366 src = conf->headers_source->elts;
2313 for (i = 0; i < conf->headers_source->nelts; i++) { 2367 for (i = 0; i < conf->headers_source->nelts; i++) {