Changeset View
Changeset View
Standalone View
Standalone View
src/applications/celerity/controller/CelerityResourceController.php
| Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | if ($data === null) { | ||||
| } | } | ||||
| if ($cache) { | if ($cache) { | ||||
| $cache->setKey($cache_key, $data); | $cache->setKey($cache_key, $data); | ||||
| } | } | ||||
| } | } | ||||
| $response = id(new AphrontFileResponse()) | $response = id(new AphrontFileResponse()) | ||||
| ->setMimeType($type_map[$type]); | |||||
| $range = AphrontRequest::getHTTPHeader('Range'); | |||||
| if (strlen($range)) { | |||||
| $response->setContentLength(strlen($data)); | |||||
| list($range_begin, $range_end) = $response->parseHTTPRange($range); | |||||
| if ($range_begin !== null) { | |||||
| if ($range_end !== null) { | |||||
| $data = substr($data, $range_begin, ($range_end - $range_begin)); | |||||
| } else { | |||||
| $data = substr($data, $range_begin); | |||||
| } | |||||
| } | |||||
| $response->setContentIterator(array($data)); | |||||
| } else { | |||||
| $response | |||||
| ->setContent($data) | ->setContent($data) | ||||
| ->setMimeType($type_map[$type]) | |||||
| ->setCompressResponse(true); | ->setCompressResponse(true); | ||||
| } | |||||
| // NOTE: This is a piece of magic required to make WOFF fonts work in | // NOTE: This is a piece of magic required to make WOFF fonts work in | ||||
| // Firefox and IE. Possibly we should generalize this more. | // Firefox and IE. Possibly we should generalize this more. | ||||
| $cross_origin_types = array( | $cross_origin_types = array( | ||||
| 'woff' => true, | 'woff' => true, | ||||
| 'woff2' => true, | 'woff2' => true, | ||||
| 'eot' => true, | 'eot' => true, | ||||
| ▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines | |||||