Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/sink/AphrontPHPHTTPSink.php
<?php | <?php | ||||
/** | /** | ||||
* Concrete HTTP sink which uses "echo" and "header()" to emit data. | * Concrete HTTP sink which uses "echo" and "header()" to emit data. | ||||
*/ | */ | ||||
final class AphrontPHPHTTPSink extends AphrontHTTPSink { | final class AphrontPHPHTTPSink extends AphrontHTTPSink { | ||||
protected function emitHTTPStatus($code, $message = '') { | protected function emitHTTPStatus($code, $message = '') { | ||||
if ($code != 200) { | if ($code != 200) { | ||||
$header = "HTTP/1.0 {$code}"; | $header = "HTTP/1.0 {$code}"; | ||||
if (strlen($message)) { | if (phutil_nonempty_string($message)) { | ||||
$header .= " {$message}"; | $header .= " {$message}"; | ||||
} | } | ||||
header($header); | header($header); | ||||
} | } | ||||
} | } | ||||
protected function emitHeader($name, $value) { | protected function emitHeader($name, $value) { | ||||
header("{$name}: {$value}", $replace = false); | header("{$name}: {$value}", $replace = false); | ||||
Show All 17 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