4 * In Git, there appears to be no way to send a message which will be output
5 * by `git clone http://...`, although the response code is visible. We send
6 * the message in a header which is visible with "GIT_CURL_VERBOSE" if you
9 * In Mercurial, the HTTP status response message is printed to the console, so
10 * we send human-readable text there.
12 * In Subversion, we can get it to print a custom message if we send an
13 * invalid/unknown response code, although the output is ugly and difficult
14 * to read. For known codes like 404, it prints a canned message.
16 * All VCS binaries ignore the response body; we include it only for
19 final class PhabricatorVCSResponse
extends AphrontResponse
{
24 public function __construct($code, $message) {
27 $message = head(phutil_split_lines($message));
28 $this->message
= $message;
31 public function getMessage() {
32 return $this->message
;
35 public function buildResponseString() {
36 return $this->code
.' '.$this->message
;
39 public function getHeaders() {
42 if ($this->getHTTPResponseCode() == 401) {
45 'Basic realm="Phabricator Repositories"',
49 $message = $this->getMessage();
50 if (strlen($message)) {
51 foreach (phutil_split_lines($message, false) as $line) {
53 'X-Phabricator-Message',
62 public function getCacheHeaders() {
66 public function getHTTPResponseCode() {
70 public function getHTTPResponseMessage() {
71 return $this->message
;