diff src/http/modules/ngx_http_fastcgi_module.c @ 3439:3354dfba9da4 stable-0.7

merge r3137, r3198, r3199, r3353, r3370, r3371, r3398, r3399: cache related fixes: *) do not pass buf with empty cached response, this fixes "zero size buf in output" alert *) hide cacheable Set-Cookie and P3P FastCGI response headers *) test comma separator in "Cache-Control" *) a cache manager thread handle was overwritten by a cache loader thread handle, this caused an exit delay, the bug had been introduced in r3248 *) fix handling cached HTTP/0.9 response *) log proxied HTTP/0.9 responses status as "009" *) fix the "If-None-Match" header name *) fix a cached zero-length body case
author Igor Sysoev <igor@sysoev.ru>
date Mon, 01 Feb 2010 15:46:14 +0000
parents 0189a8f4c7c3
children 0d8b8c84bab7
line wrap: on
line diff
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -523,6 +523,23 @@ static ngx_str_t  ngx_http_fastcgi_hide_
 };
 
 
+#if (NGX_HTTP_CACHE)
+
+static ngx_str_t  ngx_http_fastcgi_hide_cache_headers[] = {
+    ngx_string("Status"),
+    ngx_string("X-Accel-Expires"),
+    ngx_string("X-Accel-Redirect"),
+    ngx_string("X-Accel-Limit-Rate"),
+    ngx_string("X-Accel-Buffering"),
+    ngx_string("X-Accel-Charset"),
+    ngx_string("Set-Cookie"),
+    ngx_string("P3P"),
+    ngx_null_string
+};
+
+#endif
+
+
 static ngx_path_init_t  ngx_http_fastcgi_temp_path = {
     ngx_string(NGX_HTTP_FASTCGI_TEMP_PATH), { 1, 2, 0 }
 };
@@ -1899,6 +1916,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf
     u_char                       *p;
     size_t                        size;
     uintptr_t                    *code;
+    ngx_str_t                    *h;
     ngx_uint_t                    i;
     ngx_keyval_t                 *src;
     ngx_hash_init_t               hash;
@@ -2119,10 +2137,18 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf
     hash.bucket_size = ngx_align(64, ngx_cacheline_size);
     hash.name = "fastcgi_hide_headers_hash";
 
+#if (NGX_HTTP_CACHE)
+
+    h = conf->upstream.cache ? ngx_http_fastcgi_hide_cache_headers:
+                               ngx_http_fastcgi_hide_headers;
+#else
+
+    h = ngx_http_fastcgi_hide_headers;
+
+#endif
+
     if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream,
-                                            &prev->upstream,
-                                            ngx_http_fastcgi_hide_headers,
-                                            &hash)
+                                            &prev->upstream, h, &hash)
         != NGX_OK)
     {
         return NGX_CONF_ERROR;