aboutsummaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-06-26 10:32:50 +0200
committerMorris Jobke <hey@morrisjobke.de>2018-06-26 16:14:15 +0200
commit79d9841bce94c0e9abf5e53c845236296a8999de (patch)
treeb676ba133dbf68ad0d64ba21bf192bdb4308294a /index.php
parentd9d557a5ef31d63a8807feac1c530c36a077607f (diff)
downloadnextcloud-server-79d9841bce94c0e9abf5e53c845236296a8999de.tar.gz
nextcloud-server-79d9841bce94c0e9abf5e53c845236296a8999de.zip
Replace hardcoded status headers with calls to http_response_code()
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'index.php')
-rw-r--r--index.php18
1 files changed, 3 insertions, 15 deletions
diff --git a/index.php b/index.php
index b66281e6449..f0e763f797c 100644
--- a/index.php
+++ b/index.php
@@ -54,7 +54,7 @@ try {
\OC::$server->getLogger()->logException($ex2, array('app' => 'index'));
//show the user a detailed error page
- OC_Template::printExceptionErrorPage($ex, \OC_Response::STATUS_INTERNAL_SERVER_ERROR);
+ OC_Template::printExceptionErrorPage($ex, 500);
}
} catch (\OC\User\LoginException $ex) {
OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage(), OC_Response::STATUS_FORBIDDEN);
@@ -62,24 +62,12 @@ try {
\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
//show the user a detailed error page
- OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
- OC_Template::printExceptionErrorPage($ex);
+ OC_Template::printExceptionErrorPage($ex, 500);
} catch (Error $ex) {
try {
\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
} catch (Error $e) {
-
- $claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']);
- $validProtocols = [
- 'HTTP/1.0',
- 'HTTP/1.1',
- 'HTTP/2',
- ];
- $protocol = 'HTTP/1.1';
- if(in_array($claimedProtocol, $validProtocols, true)) {
- $protocol = $claimedProtocol;
- }
- header($protocol . ' 500 Internal Server Error');
+ http_response_code(500);
header('Content-Type: text/plain; charset=utf-8');
print("Internal Server Error\n\n");
print("The server encountered an internal error and was unable to complete your request.\n");