@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Return Git HTTP error messages in an HTTP header

Summary:
Ref T13590. Currently, when you encounter a HTTP error in Git, there is no apparent way to make the client show any additional useful information. In particular, the response body is ignored.

We can partially get around this by putting the information in an "X-Phabricator-Message: ..." HTTP header, which is visible with "GIT_CURL_VERBOSE=1 git ...". Users won't normally know to look here, but it's still better than nothing.

Test Plan:
- Ran "GIT_CURL_VERBOSE=1 git fetch" against a Phabricator HTTP URI that returned a HTTP/500 error.
- Before: no clue what happened on the client.
- After: client shows useful message in the "X-Phabricator-Message" header in debug output.

Maniphest Tasks: T13590

Differential Revision: https://secure.phabricator.com/D21523

+13 -1
+13 -1
src/applications/repository/response/PhabricatorVCSResponse.php
··· 2 2 3 3 /** 4 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. 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 7 + * know where to look. 6 8 * 7 9 * In Mercurial, the HTTP status response message is printed to the console, so 8 10 * we send human-readable text there. ··· 42 44 'WWW-Authenticate', 43 45 'Basic realm="Phabricator Repositories"', 44 46 ); 47 + } 48 + 49 + $message = $this->getMessage(); 50 + if (strlen($message)) { 51 + foreach (phutil_split_lines($message, false) as $line) { 52 + $headers[] = array( 53 + 'X-Phabricator-Message', 54 + $line, 55 + ); 56 + } 45 57 } 46 58 47 59 return $headers;