diff --git a/flight/Engine.php b/flight/Engine.php index 5d8c194..879d606 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -104,6 +104,7 @@ class Engine { $this->set('flight.views.path', './views'); $this->set('flight.log_errors', false); $this->set('flight.handle_errors', true); + $this->set('flight.base_url', null); $initialized = true; } @@ -321,13 +322,11 @@ class Engine { * * @param int $code HTTP status code * @param string $message Response message - * @param bool $cache Cache response */ - public function _halt($code = 200, $message = '', $cache = false) { + public function _halt($code = 200, $message = '') { $this->response(false) ->status($code) ->write($message) - ->cache($cache) ->send(); } @@ -440,7 +439,7 @@ class Engine { $this->response()->header('ETag', $id); if ($id === getenv('HTTP_IF_NONE_MATCH')) { - $this->halt(304, '', true); + $this->halt(304); } } @@ -453,7 +452,7 @@ class Engine { $this->response()->header('Last-Modified', date(DATE_RFC1123, $time)); if ($time === strtotime(getenv('HTTP_IF_MODIFIED_SINCE'))) { - $this->halt(304, '', true); + $this->halt(304); } } } diff --git a/flight/net/Response.php b/flight/net/Response.php index 77a232b..4ce1d00 100644 --- a/flight/net/Response.php +++ b/flight/net/Response.php @@ -151,21 +151,19 @@ class Response { * @return object Self reference */ public function cache($expires) { - if ($expires !== true) { - if ($expires === false) { - $this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; - $this->headers['Cache-Control'] = array( - 'no-store, no-cache, must-revalidate', - 'post-check=0, pre-check=0', - 'max-age=0' - ); - $this->headers['Pragma'] = 'no-cache'; - } - else { - $expires = is_int($expires) ? $expires : strtotime($expires); - $this->headers['Expires'] = gmdate('D, d M Y H:i:s', $expires) . ' GMT'; - $this->headers['Cache-Control'] = 'max-age='.($expires - time()); - } + if ($expires === false) { + $this->headers['Expires'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; + $this->headers['Cache-Control'] = array( + 'no-store, no-cache, must-revalidate', + 'post-check=0, pre-check=0', + 'max-age=0' + ); + $this->headers['Pragma'] = 'no-cache'; + } + else { + $expires = is_int($expires) ? $expires : strtotime($expires); + $this->headers['Expires'] = gmdate('D, d M Y H:i:s', $expires) . ' GMT'; + $this->headers['Cache-Control'] = 'max-age='.($expires - time()); } return $this;