Make minor correctness and display improvements to pull logs
Summary: Depends on D18915. Ref T13046. - Distinguish between HTTP and HTTPS. - Use more constants and fewer magical strings. - For HTTP responses, give them better type information and more helpful UI behaviors. Test Plan: Pulled over SSH and HTTP. Reviewed resulting logs from the web UI. Hit errors like missing/invalid credentials. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13046 Differential Revision: https://secure.phabricator.com/D18917
This commit is contained in:
@@ -104,15 +104,29 @@ final class DiffusionServeController extends DiffusionController {
|
||||
try {
|
||||
$remote_addr = $request->getRemoteAddress();
|
||||
|
||||
if ($request->isHTTPS()) {
|
||||
$remote_protocol = PhabricatorRepositoryPullEvent::PROTOCOL_HTTPS;
|
||||
} else {
|
||||
$remote_protocol = PhabricatorRepositoryPullEvent::PROTOCOL_HTTP;
|
||||
}
|
||||
|
||||
$pull_event = id(new PhabricatorRepositoryPullEvent())
|
||||
->setEpoch(PhabricatorTime::getNow())
|
||||
->setRemoteAddress($remote_addr)
|
||||
->setRemoteProtocol('http');
|
||||
->setRemoteProtocol($remote_protocol);
|
||||
|
||||
if ($response) {
|
||||
$pull_event
|
||||
->setResultType('wild')
|
||||
->setResultCode($response->getHTTPResponseCode());
|
||||
$response_code = $response->getHTTPResponseCode();
|
||||
|
||||
if ($response_code == 200) {
|
||||
$pull_event
|
||||
->setResultType(PhabricatorRepositoryPullEvent::RESULT_PULL)
|
||||
->setResultCode($response_code);
|
||||
} else {
|
||||
$pull_event
|
||||
->setResultType(PhabricatorRepositoryPullEvent::RESULT_ERROR)
|
||||
->setResultCode($response_code);
|
||||
}
|
||||
|
||||
if ($response instanceof PhabricatorVCSResponse) {
|
||||
$pull_event->setProperties(
|
||||
@@ -122,7 +136,7 @@ final class DiffusionServeController extends DiffusionController {
|
||||
}
|
||||
} else {
|
||||
$pull_event
|
||||
->setResultType('exception')
|
||||
->setResultType(PhabricatorRepositoryPullEvent::RESULT_EXCEPTION)
|
||||
->setResultCode(500)
|
||||
->setProperties(
|
||||
array(
|
||||
|
||||
Reference in New Issue
Block a user