Path: blob/master/src/aphront/sink/AphrontPHPHTTPSink.php
12249 views
<?php12/**3* Concrete HTTP sink which uses "echo" and "header()" to emit data.4*/5final class AphrontPHPHTTPSink extends AphrontHTTPSink {67protected function emitHTTPStatus($code, $message = '') {8if ($code != 200) {9$header = "HTTP/1.0 {$code}";10if (strlen($message)) {11$header .= " {$message}";12}13header($header);14}15}1617protected function emitHeader($name, $value) {18header("{$name}: {$value}", $replace = false);19}2021protected function emitData($data) {22echo $data;2324// NOTE: We don't call flush() here because it breaks HTTPS under Apache.25// See T7620 for discussion. Even without an explicit flush, PHP appears to26// have reasonable behavior here: the echo will block if internal buffers27// are full, and data will be sent to the client once enough of it has28// been buffered.29}3031protected function isWritable() {32return !connection_aborted();33}3435}363738