Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/response/AphrontResponse.php
| Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | protected function addJSONShield($json_response) { | ||||
| $response = $shield.$json_response; | $response = $shield.$json_response; | ||||
| return $response; | return $response; | ||||
| } | } | ||||
| public function getCacheHeaders() { | public function getCacheHeaders() { | ||||
| $headers = array(); | $headers = array(); | ||||
| if ($this->cacheable) { | if ($this->cacheable) { | ||||
| $cache_control = array(); | |||||
| $cache_control[] = sprintf('max-age=%d', $this->cacheable); | |||||
| if ($this->canCDN) { | if ($this->canCDN) { | ||||
| $headers[] = array( | $cache_control[] = 'public'; | ||||
| 'Cache-Control', | |||||
| 'public', | |||||
| ); | |||||
| } else { | } else { | ||||
| $cache_control[] = 'private'; | |||||
| } | |||||
| $headers[] = array( | $headers[] = array( | ||||
| 'Cache-Control', | 'Cache-Control', | ||||
| 'private', | implode(', ', $cache_control), | ||||
epriestley: This isn't directly related, just cleaning up the caching headers a little and making them more… | |||||
| ); | ); | ||||
| } | |||||
| $headers[] = array( | $headers[] = array( | ||||
| 'Expires', | 'Expires', | ||||
| $this->formatEpochTimestampForHTTPHeader(time() + $this->cacheable), | $this->formatEpochTimestampForHTTPHeader(time() + $this->cacheable), | ||||
| ); | ); | ||||
| } else { | } else { | ||||
| $headers[] = array( | $headers[] = array( | ||||
| 'Cache-Control', | 'Cache-Control', | ||||
| Show All 34 Lines | |||||
This isn't directly related, just cleaning up the caching headers a little and making them more explicit.