From 10d0db6328721a13a1f27080f1d3b3c0f1363d6c Mon Sep 17 00:00:00 2001
From: Andrey Kulikov <amdei@cryptopro.ru>
Date: Mon, 27 Apr 2020 13:58:43 +0300
Subject: [PATCH] Add missing check for r->cache pointer validity in
 ngx_http_upstream_send_response().

---
 src/http/ngx_http_upstream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index cc8505b..8af0b21 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -3316,7 +3316,7 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
         break;
     }
 
-    if (u->cacheable) {
+    if (u->cacheable && r->cache) {
         time_t  now, valid;
 
         now = ngx_time();
-- 
2.20.1

