Changeset 603 for trunk/lib/App.inc.php
- Timestamp:
- May 3, 2017 1:47:56 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/App.inc.php
r596 r603 100 100 'signing_method' => 'sha512+base64', 101 101 102 // Content type of output sent in the Content-type: http header. 103 'content_type' => 'text/html', 104 105 // Allow HTTP caching with max-age setting. Possible values: 106 // >= 1 Allow HTTP caching with this value set as the max-age (in seconds, i.e., 3600 = 1 hour). 107 // 0 Disallow HTTP caching. 108 // false Don't send any cache-related HTTP headers (if you want to control this via server config or custom headers) 109 // This should be '0' for websites that use authentication or have frequently changing dynamic content. 110 'http_cache_headers' => 0, 111 102 112 // Character set for page output. Used in the Content-Type header and the HTML <meta content-type> tag. 103 113 'character_set' => 'utf-8', … … 476 486 if (!$this->cli) { 477 487 if (!headers_sent($h_file, $h_line)) { 478 header(sprintf('Content-type: text/html; charset=%s', $this->getParam('character_set')));488 header(sprintf('Content-type: %s; charset=%s', $this->getParam('content_type'), $this->getParam('character_set'))); 479 489 } else { 480 490 $this->logMsg(sprintf('Unable to set Content-type; headers already sent (output started in %s : %s)', $h_file, $h_line), LOG_DEBUG, __FILE__, __LINE__); 491 } 492 } 493 494 // Cache control headers. 495 if (!$this->cli && false !== $this->getParam('http_cache_headers')) { 496 if (!headers_sent($h_file, $h_line)) { 497 if ($this->getParam('http_cache_headers') > 0) { 498 // Allow HTTP caching, for this many seconds. 499 header(sprintf('Cache-Control: no-transform, public, max-age=%d', $this->getParam('http_cache_headers'))); 500 header('Vary: Accept-Encoding'); 501 } else { 502 // Disallow HTTP caching entirely. http://stackoverflow.com/a/2068407 503 header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1. 504 header('Pragma: no-cache'); // HTTP 1.0. 505 header('Expires: 0'); // Proxies. 506 } 507 } else { 508 $this->logMsg(sprintf('Unable to set Cache-Control; headers already sent (output started in %s : %s)', $h_file, $h_line), LOG_DEBUG, __FILE__, __LINE__); 481 509 } 482 510 }
Note: See TracChangeset
for help on using the changeset viewer.