Changeset View
Changeset View
Standalone View
Standalone View
src/future/http/HTTPSFuture.php
Show First 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | final class HTTPSFuture extends BaseHTTPFuture { | ||||
} | } | ||||
public function isReady() { | public function isReady() { | ||||
if ($this->hasResult()) { | if ($this->hasResult()) { | ||||
return true; | return true; | ||||
} | } | ||||
$uri = $this->getURI(); | $uri = $this->getURI(); | ||||
$domain = id(new PhutilURI($uri))->getDomain(); | $domain = (new PhutilURI($uri))->getDomain(); | ||||
$is_download = $this->isDownload(); | $is_download = $this->isDownload(); | ||||
// See T13396. For now, use the streaming response parser only if we're | // See T13396. For now, use the streaming response parser only if we're | ||||
// downloading the response to disk. | // downloading the response to disk. | ||||
$use_streaming_parser = (bool)$is_download; | $use_streaming_parser = (bool)$is_download; | ||||
if (!$this->handle) { | if (!$this->handle) { | ||||
▲ Show 20 Lines • Show All 222 Lines • ▼ Show 20 Lines | if (!$this->handle) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Failed to open filesystem path "%s" for writing.', | 'Failed to open filesystem path "%s" for writing.', | ||||
$this->downloadPath)); | $this->downloadPath)); | ||||
} | } | ||||
} | } | ||||
if ($use_streaming_parser) { | if ($use_streaming_parser) { | ||||
$streaming_parser = id(new PhutilHTTPResponseParser()) | $streaming_parser = (new PhutilHTTPResponseParser()) | ||||
->setFollowLocationHeaders($this->getFollowLocation()); | ->setFollowLocationHeaders($this->getFollowLocation()); | ||||
if ($this->downloadHandle) { | if ($this->downloadHandle) { | ||||
$streaming_parser->setWriteHandle($this->downloadHandle); | $streaming_parser->setWriteHandle($this->downloadHandle); | ||||
} | } | ||||
$progress_sink = $this->getProgressSink(); | $progress_sink = $this->getProgressSink(); | ||||
if ($progress_sink) { | if ($progress_sink) { | ||||
▲ Show 20 Lines • Show All 410 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