From 4a93c661a852f4241ad90eaf8ddde8fab19ca313 Mon Sep 17 00:00:00 2001 From: n0nag0n Date: Fri, 12 Jul 2024 21:40:58 -0600 Subject: [PATCH] corrected the cache behavior in some areas --- flight/Engine.php | 5 +++++ flight/net/Response.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/flight/Engine.php b/flight/Engine.php index a1378a6..4dd595f 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -610,6 +610,7 @@ class Engine try { $this->response() + ->cache(0) ->clearBody() ->status(500) ->write($msg) @@ -736,6 +737,10 @@ class Engine */ public function _halt(int $code = 200, string $message = '', bool $actuallyExit = true): void { + if ($this->response()->getHeader('Cache-Control') === null) { + $this->response()->cache(0); + } + $this->response() ->clearBody() ->status($code) diff --git a/flight/net/Response.php b/flight/net/Response.php index 362fe5d..73be770 100644 --- a/flight/net/Response.php +++ b/flight/net/Response.php @@ -286,7 +286,7 @@ class Response */ public function cache($expires): self { - if ($expires === false) { + if ($expires === false || $expires === 0) { $this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; $this->headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; $this->headers['Pragma'] = 'no-cache';