Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/response/PhabricatorVCSResponse.php
| <?php | <?php | ||||
| /** | /** | ||||
| * In Git, there appears to be no way to send a message which will be output | * In Git, there appears to be no way to send a message which will be output | ||||
| * by `git clone http://...`, although the response code is visible. | * by `git clone http://...`, although the response code is visible. We send | ||||
| * the message in a header which is visible with "GIT_CURL_VERBOSE" if you | |||||
| * know where to look. | |||||
| * | * | ||||
| * In Mercurial, the HTTP status response message is printed to the console, so | * In Mercurial, the HTTP status response message is printed to the console, so | ||||
| * we send human-readable text there. | * we send human-readable text there. | ||||
| * | * | ||||
| * In Subversion, we can get it to print a custom message if we send an | * In Subversion, we can get it to print a custom message if we send an | ||||
| * invalid/unknown response code, although the output is ugly and difficult | * invalid/unknown response code, although the output is ugly and difficult | ||||
| * to read. For known codes like 404, it prints a canned message. | * to read. For known codes like 404, it prints a canned message. | ||||
| * | * | ||||
| Show All 25 Lines | public function getHeaders() { | ||||
| if ($this->getHTTPResponseCode() == 401) { | if ($this->getHTTPResponseCode() == 401) { | ||||
| $headers[] = array( | $headers[] = array( | ||||
| 'WWW-Authenticate', | 'WWW-Authenticate', | ||||
| 'Basic realm="Phabricator Repositories"', | 'Basic realm="Phabricator Repositories"', | ||||
| ); | ); | ||||
| } | } | ||||
| $message = $this->getMessage(); | |||||
| if (strlen($message)) { | |||||
| foreach (phutil_split_lines($message, false) as $line) { | |||||
| $headers[] = array( | |||||
| 'X-Phabricator-Message', | |||||
| $line, | |||||
| ); | |||||
| } | |||||
| } | |||||
| return $headers; | return $headers; | ||||
| } | } | ||||
| public function getCacheHeaders() { | public function getCacheHeaders() { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| public function getHTTPResponseCode() { | public function getHTTPResponseCode() { | ||||
| return $this->code; | return $this->code; | ||||
| } | } | ||||
| public function getHTTPResponseMessage() { | public function getHTTPResponseMessage() { | ||||
| return $this->message; | return $this->message; | ||||
| } | } | ||||
| } | } | ||||