Source for file HttpContext.php
Documentation is available at HttpContext.php
6: * @copyright Copyright (c) 2004, 2010 David Grudl
7: * @license http://nettephp.com/license Nette license
8: * @link http://nettephp.com
16: * HTTP-specific tasks.
18: * @copyright Copyright (c) 2004, 2010 David Grudl
26: * Attempts to cache the sent entity by its last modification date
27: * @param string|int|DateTime last modified time
28: * @param string strong entity tag validator
31: public function isModified($lastModified =
NULL, $etag =
NULL)
37: $response->setHeader('Last-Modified', $response->date($lastModified));
43: $ifNoneMatch =
$request->getHeader('If-None-Match');
44: if ($ifNoneMatch ===
'*') {
45: $match =
TRUE; // match, check if-modified-since
47: } elseif ($ifNoneMatch !==
NULL) {
48: $etag =
$response->getHeader('ETag');
50: if ($etag ==
NULL ||
strpos(' ' .
strtr($ifNoneMatch, ",\t", ' '), ' ' .
$etag) ===
FALSE) {
54: $match =
TRUE; // match, check if-modified-since
58: $ifModifiedSince =
$request->getHeader('If-Modified-Since');
59: if ($ifModifiedSince !==
NULL) {
60: $lastModified =
$response->getHeader('Last-Modified');
79: /********************* backend ****************d*g**/
84: * @return IHttpRequest
94: * @return IHttpResponse