Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/response/AphrontFileResponse.php
Context not available. | |||||
} | } | ||||
public function setDownload($download) { | public function setDownload($download) { | ||||
if (!strlen($download)) { | if (!@strlen($download)) { | ||||
$download = 'untitled'; | $download = 'untitled'; | ||||
} | } | ||||
$this->download = $download; | $this->download = $download; | ||||
Context not available. | |||||
} | } | ||||
public function setContent($content) { | public function setContent($content) { | ||||
$this->setContentLength(strlen($content)); | $this->setContentLength(@strlen($content)); | ||||
$this->content = $content; | $this->content = $content; | ||||
return $this; | return $this; | ||||
} | } | ||||
Context not available. | |||||
$headers[] = array('Content-Length', $content_len); | $headers[] = array('Content-Length', $content_len); | ||||
} | } | ||||
if (strlen($this->getDownload())) { | if (@strlen($this->getDownload())) { | ||||
$headers[] = array('X-Download-Options', 'noopen'); | $headers[] = array('X-Download-Options', 'noopen'); | ||||
$filename = $this->getDownload(); | $filename = $this->getDownload(); | ||||
Context not available. | |||||
$end = null; | $end = null; | ||||
$matches = null; | $matches = null; | ||||
if (preg_match('/^bytes=(\d+)-(\d*)$/', $range, $matches)) { | if (@preg_match('/^bytes=(\d+)-(\d*)$/', $range, $matches)) { | ||||
// Note that the "Range" header specifies bytes differently than | // Note that the "Range" header specifies bytes differently than | ||||
// we do internally: the range 0-1 has 2 bytes (byte 0 and byte 1). | // we do internally: the range 0-1 has 2 bytes (byte 0 and byte 1). | ||||
$begin = (int)$matches[1]; | $begin = (int)$matches[1]; | ||||
// The "Range" may be "200-299" or "200-", meaning "until end of file". | // The "Range" may be "200-299" or "200-", meaning "until end of file". | ||||
if (strlen($matches[2])) { | if (@strlen($matches[2])) { | ||||
$range_end = (int)$matches[2]; | $range_end = (int)$matches[2]; | ||||
$end = $range_end + 1; | $end = $range_end + 1; | ||||
} else { | } else { | ||||
Context not available. |
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