Return HTTP 500, not HTTP 200, on exception pages
Summary: Ref T4064. The response code here isn't normally relevant, but we can hit these via `git clone http://../`, etc., and it's clearly more correct to use HTTP 500. Test Plan: Added a fake `throw new Exception()` and verified I got an HTTP 500 response. Reviewers: jamesr, btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4064 Differential Revision: https://secure.phabricator.com/D7507
This commit is contained in:
@@ -222,6 +222,7 @@ class AphrontDefaultApplicationConfiguration
|
||||
|
||||
$response = new AphrontWebpageResponse();
|
||||
$response->setContent($view->render());
|
||||
$response->setHTTPResponseCode(500);
|
||||
|
||||
return $response;
|
||||
}
|
||||
@@ -268,6 +269,7 @@ class AphrontDefaultApplicationConfiguration
|
||||
|
||||
$response = new AphrontDialogResponse();
|
||||
$response->setDialog($dialog);
|
||||
$response->setHTTPResponseCode(500);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -249,9 +249,10 @@ abstract class PhabricatorController extends AphrontController {
|
||||
$view->appendChild(hsprintf(
|
||||
'<div style="padding: 2em 0;">%s</div>',
|
||||
$response->buildResponseString()));
|
||||
$response = new AphrontWebpageResponse();
|
||||
$response->setContent($view->render());
|
||||
return $response;
|
||||
$page_response = new AphrontWebpageResponse();
|
||||
$page_response->setContent($view->render());
|
||||
$page_response->setHTTPResponseCode($response->getHTTPResponseCode());
|
||||
return $page_response;
|
||||
} else {
|
||||
$response->getDialog()->setIsStandalone(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user