Changeset View
Changeset View
Standalone View
Standalone View
src/applications/celerity/controller/CelerityResourceController.php
Show First 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | protected function serveResource(array $spec) { | ||||
// The "Content-Security-Policy" header has no effect on the actual | // The "Content-Security-Policy" header has no effect on the actual | ||||
// resources, only on the main request. Disable it on the resource | // resources, only on the main request. Disable it on the resource | ||||
// responses to limit confusion. | // responses to limit confusion. | ||||
$response->setDisableContentSecurityPolicy(true); | $response->setDisableContentSecurityPolicy(true); | ||||
$range = AphrontRequest::getHTTPHeader('Range'); | $range = AphrontRequest::getHTTPHeader('Range'); | ||||
if (strlen($range)) { | if (phutil_nonempty_string($range)) { | ||||
valerio.bozzolan: ✅ the default of `getHTTPHeader()` is null (and not false or whatever) so… | |||||
$response->setContentLength(strlen($data)); | $response->setContentLength(strlen($data)); | ||||
list($range_begin, $range_end) = $response->parseHTTPRange($range); | list($range_begin, $range_end) = $response->parseHTTPRange($range); | ||||
if ($range_begin !== null) { | if ($range_begin !== null) { | ||||
if ($range_end !== null) { | if ($range_end !== null) { | ||||
$data = substr($data, $range_begin, ($range_end - $range_begin)); | $data = substr($data, $range_begin, ($range_end - $range_begin)); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
✅ the default of getHTTPHeader() is null (and not false or whatever) so phutil_nonempty_string should receive a correct input domain of string and null.