aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-07-19 15:31:46 +0000
committerIgor Sysoev <igor@sysoev.ru>2010-07-19 15:31:46 +0000
commitf297d0dd2771f4993b144b56c6f175504c8d53c4 (patch)
treeda3edcdb7afaee4c5723cdb98908eed3c4fb1589
parentcc963cd7e22619c9f53bd6cdfb957652622bea17 (diff)
downloadnginx-f297d0dd2771f4993b144b56c6f175504c8d53c4.tar.gz
nginx-f297d0dd2771f4993b144b56c6f175504c8d53c4.zip
an intercepted error code was not cached
-rw-r--r--src/http/ngx_http_upstream.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index 2f295c2f6..76e949c26 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -1720,6 +1720,24 @@ ngx_http_upstream_intercept_errors(ngx_http_request_t *r,
r->headers_out.www_authenticate = h;
}
+#if (NGX_HTTP_CACHE)
+
+ if (u->cacheable && r->cache) {
+ time_t valid;
+
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
+ "http upstream cache fd: %d", r->cache->file.fd);
+
+ valid = ngx_http_file_cache_valid(u->conf->cache_valid, status);
+
+ if (valid) {
+ r->cache->valid_sec = ngx_time() + valid;
+ r->cache->error = status;
+ }
+
+ ngx_http_file_cache_free(r, u->pipe->temp_file);
+ }
+#endif
ngx_http_upstream_finalize_request(r, u, status);
return NGX_OK;