corrected the cache behavior in some areas

pull/599/head
n0nag0n 6 months ago
parent 8dd255c487
commit 4a93c661a8

@ -610,6 +610,7 @@ class Engine
try { try {
$this->response() $this->response()
->cache(0)
->clearBody() ->clearBody()
->status(500) ->status(500)
->write($msg) ->write($msg)
@ -736,6 +737,10 @@ class Engine
*/ */
public function _halt(int $code = 200, string $message = '', bool $actuallyExit = true): void 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() $this->response()
->clearBody() ->clearBody()
->status($code) ->status($code)

@ -286,7 +286,7 @@ class Response
*/ */
public function cache($expires): self 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['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT';
$this->headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'; $this->headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0';
$this->headers['Pragma'] = 'no-cache'; $this->headers['Pragma'] = 'no-cache';

Loading…
Cancel
Save