@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3/**
4 * Concrete HTTP sink which uses "echo" and "header()" to emit data.
5 */
6final class AphrontPHPHTTPSink extends AphrontHTTPSink {
7
8 protected function emitHTTPStatus($code, $message = '') {
9 if ($code != 200) {
10 $header = "HTTP/1.0 {$code}";
11 if (phutil_nonempty_string($message)) {
12 $header .= " {$message}";
13 }
14 header($header);
15 }
16 }
17
18 protected function emitHeader($name, $value) {
19 header("{$name}: {$value}", $replace = false);
20 }
21
22 protected function emitData($data) {
23 echo $data;
24
25 // NOTE: We don't call flush() here because it breaks HTTPS under Apache.
26 // See T7620 for discussion. Even without an explicit flush, PHP appears to
27 // have reasonable behavior here: the echo will block if internal buffers
28 // are full, and data will be sent to the client once enough of it has
29 // been buffered.
30 }
31
32 protected function isWritable() {
33 return !connection_aborted();
34 }
35
36}