mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-02 15:39:36 +01:00
Summary: Ref T7149. This still buffers the whole file, but is reaaaaal close to not doing that. Allow Responses to be streamed, and rewrite the range stuff in the FileResponse so it does not rely on having the entire content available. Test Plan: - Artificially slowed down downloads, suspended/resumed them (works in chrome, not so much in Safari/Firefox?) - Played sounds in Safari/Chrome. - Viewed a bunch of pages and files in every browser. Reviewers: btrahan Reviewed By: btrahan Subscribers: joshuaspence, epriestley Maniphest Tasks: T7149 Differential Revision: https://secure.phabricator.com/D12072
40 lines
703 B
PHP
40 lines
703 B
PHP
<?php
|
|
|
|
/**
|
|
* Isolated HTTP sink for testing.
|
|
*/
|
|
final class AphrontIsolatedHTTPSink extends AphrontHTTPSink {
|
|
|
|
private $status;
|
|
private $headers;
|
|
private $data;
|
|
|
|
protected function emitHTTPStatus($code, $message = '') {
|
|
$this->status = $code;
|
|
}
|
|
|
|
protected function emitHeader($name, $value) {
|
|
$this->headers[] = array($name, $value);
|
|
}
|
|
|
|
protected function emitData($data) {
|
|
$this->data .= $data;
|
|
}
|
|
|
|
protected function isWritable() {
|
|
return true;
|
|
}
|
|
|
|
public function getEmittedHTTPStatus() {
|
|
return $this->status;
|
|
}
|
|
|
|
public function getEmittedHeaders() {
|
|
return $this->headers;
|
|
}
|
|
|
|
public function getEmittedData() {
|
|
return $this->data;
|
|
}
|
|
|
|
}
|