private function notModified(HeaderManager $headers) { //Clear output buffers while (ob_get_level()) { ob_end_clean(); } //Start a new buffer ob_start(); //Send 304 not modified $headers->Status(304); }
function execute($method) { if ($method == 'GET') { $this->cache->preExecute(); } //No assumptions $method = strtoupper($method); //Add to Page\Handler Stack PH::Push($this); //Setup output buffering ob_start(); $real_method = $method; $depth = 0; while ($this->page->can($method) || $this->can_fake($method)) { $depth++; if ($this->can_fake($method)) { $method = 'GET'; } $return = $this->page->execute_request($method); if ($return) { ob_clean(); $this->page = $return; } else { if (!$this->page->can($real_method)) { if ($real_method == 'HEAD') { //$contents = ob_get_contents(); //Headers only, no body ob_clean(); } } break; } //Infinite loop? if ($depth > static::MAX_REQUEST_DEPTH) { PH::Pop(); ob_end_flush(); $this->headers->Clear(); throw new PageHandlerException('Max request depth of ' . static::MAX_REQUEST_DEPTH . ' exceeded.'); } } ob_end_flush(); //Nothing was handled if (!$depth) { PH::Pop(); $this->headers->Clear(); throw new PageHandlerException('Invalid or unknown method ' . $method); } //Pass to the cache handler if ($method == 'GET') { $this->cache->postExecute($this->headers); } }