diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2698,6 +2698,7 @@ 'PhabricatorVeryWowEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorVeryWowEnglishTranslation.php', 'PhabricatorViewerDatasource' => 'applications/people/typeahead/PhabricatorViewerDatasource.php', 'PhabricatorWatcherHasObjectEdgeType' => 'applications/transactions/edges/PhabricatorWatcherHasObjectEdgeType.php', + 'PhabricatorWebServerSetupCheck' => 'applications/config/check/PhabricatorWebServerSetupCheck.php', 'PhabricatorWordPressAuthProvider' => 'applications/auth/provider/PhabricatorWordPressAuthProvider.php', 'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php', 'PhabricatorWorkerActiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php', @@ -6146,6 +6147,7 @@ 'PhabricatorVeryWowEnglishTranslation' => 'PhutilTranslation', 'PhabricatorViewerDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorWatcherHasObjectEdgeType' => 'PhabricatorEdgeType', + 'PhabricatorWebServerSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorWordPressAuthProvider' => 'PhabricatorOAuth2AuthProvider', 'PhabricatorWorkerActiveTask' => 'PhabricatorWorkerTask', 'PhabricatorWorkerArchiveTask' => 'PhabricatorWorkerTask', diff --git a/src/applications/config/check/PhabricatorWebServerSetupCheck.php b/src/applications/config/check/PhabricatorWebServerSetupCheck.php new file mode 100644 --- /dev/null +++ b/src/applications/config/check/PhabricatorWebServerSetupCheck.php @@ -0,0 +1,45 @@ +setDomain('127.0.0.1') + ->setPath('/status/'); + + $future = id(new HTTPSFuture($base_uri)) + ->addHeader('Host', $base_uri->getDomain()) + ->addHeader('Accept-Encoding', 'gzip') + ->addHeader('Connection', 'Close') + ->addHeader('X-Phabricator-Setup-Check', true) + ->setTimeout(5); + + list($status, $body, $headers) = $future->resolve(); + + if (BaseHTTPFuture::getHeader($headers, 'Content-Encoding') != 'gzip') { + $this->newIssue('webserver.gzip') + ->setName(pht('Enable gzip compression')) + ->setMessage(pht('Enable gzip compression.')); + return; + } + } + +}