[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 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. 6 * 7 * In Mercurial, the HTTP status response message is printed to the console, so 8 * we send human-readable text there. 9 * 10 * In Subversion, we can get it to print a custom message if we send an 11 * invalid/unknown response code, although the output is ugly and difficult 12 * to read. For known codes like 404, it prints a canned message. 13 * 14 * All VCS binaries ignore the response body; we include it only for 15 * completeness. 16 */ 17 final class PhabricatorVCSResponse extends AphrontResponse { 18 19 private $code; 20 private $message; 21 22 public function __construct($code, $message) { 23 $this->code = $code; 24 25 $message = head(phutil_split_lines($message)); 26 $this->message = $message; 27 } 28 29 public function getMessage() { 30 return $this->message; 31 } 32 33 public function buildResponseString() { 34 return $this->code.' '.$this->message; 35 } 36 37 public function getHeaders() { 38 $headers = array(); 39 40 if ($this->getHTTPResponseCode() == 401) { 41 $headers[] = array( 42 'WWW-Authenticate', 43 'Basic realm="Phabricator Repositories"', 44 ); 45 } 46 47 return $headers; 48 } 49 50 public function getCacheHeaders() { 51 return array(); 52 } 53 54 public function getHTTPResponseCode() { 55 return $this->code; 56 } 57 58 public function getHTTPResponseMessage() { 59 return $this->message; 60 } 61 62 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |