Changeset View
Changeset View
Standalone View
Standalone View
src/aphront/configuration/AphrontApplicationConfiguration.php
| Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | abstract class AphrontApplicationConfiguration extends Phobject { | ||||
| public function willBuildRequest() {} | public function willBuildRequest() {} | ||||
| /** | /** | ||||
| * @phutil-external-symbol class PhabricatorStartup | * @phutil-external-symbol class PhabricatorStartup | ||||
| */ | */ | ||||
| public static function runHTTPRequest(AphrontHTTPSink $sink) { | public static function runHTTPRequest(AphrontHTTPSink $sink) { | ||||
| if (isset($_SERVER['HTTP_X_PHABRICATOR_SELFCHECK'])) { | |||||
| $response = self::newSelfCheckResponse(); | |||||
| return self::writeResponse($sink, $response); | |||||
| } | |||||
| PhabricatorStartup::beginStartupPhase('multimeter'); | PhabricatorStartup::beginStartupPhase('multimeter'); | ||||
| $multimeter = MultimeterControl::newInstance(); | $multimeter = MultimeterControl::newInstance(); | ||||
| $multimeter->setEventContext('<http-init>'); | $multimeter->setEventContext('<http-init>'); | ||||
| $multimeter->setEventViewer('<none>'); | $multimeter->setEventViewer('<none>'); | ||||
| // Build a no-op write guard for the setup phase. We'll replace this with a | // Build a no-op write guard for the setup phase. We'll replace this with a | ||||
| // real write guard later on, but we need to survive setup and build a | // real write guard later on, but we need to survive setup and build a | ||||
| // request object first. | // request object first. | ||||
| ▲ Show 20 Lines • Show All 615 Lines • ▼ Show 20 Lines | foreach ($handlers as $handler) { | ||||
| $this->validateErrorHandlerResponse($handler, $response); | $this->validateErrorHandlerResponse($handler, $response); | ||||
| return $response; | return $response; | ||||
| } | } | ||||
| } | } | ||||
| throw $ex; | throw $ex; | ||||
| } | } | ||||
| private static function newSelfCheckResponse() { | |||||
| $path = idx($_REQUEST, '__path__', ''); | |||||
| $query = idx($_SERVER, 'QUERY_STRING', ''); | |||||
| $pairs = id(new PhutilQueryStringParser()) | |||||
| ->parseQueryStringToPairList($query); | |||||
| $params = array(); | |||||
| foreach ($pairs as $v) { | |||||
| $params[] = array( | |||||
| 'name' => $v[0], | |||||
| 'value' => $v[1], | |||||
| ); | |||||
| } | |||||
| $result = array( | |||||
| 'path' => $path, | |||||
| 'params' => $params, | |||||
| 'user' => idx($_SERVER, 'PHP_AUTH_USER'), | |||||
| 'pass' => idx($_SERVER, 'PHP_AUTH_PW'), | |||||
| // This just makes sure that the response compresses well, so reasonable | |||||
| // algorithms should want to gzip or deflate it. | |||||
| 'filler' => str_repeat('Q', 1024 * 16), | |||||
| ); | |||||
| return id(new AphrontJSONResponse()) | |||||
| ->setAddJSONShield(false) | |||||
| ->setContent($result); | |||||
| } | |||||
| } | } | ||||