From 74cc46e8f757fb1bd1d50544d4dee5db741c1af3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 12 May 2022 12:32:41 +0200 Subject: [PATCH] Use HTTP 500 in error conditions Sending a 500 Internal Server Error for unplanned errors is more appropriate than a 503 Service Unavailable, as the latter is defined: RFC 7231#6.6.4: > The 503 (Service Unavailable) status code indicates that the server > is currently unable to handle the request due to a temporary overload > or scheduled maintenance, which will likely be alleviated after some > delay. It's not likely that the exception will resolve itself after some delay. --- wcfsetup/install/files/lib/system/WCF.class.php | 2 +- wcfsetup/install/files/proxy_sourcemap.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index f8da53a2df..bc80d8f92d 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -311,7 +311,7 @@ class WCF } } - @\header('HTTP/1.1 503 Service Unavailable'); + @\header('HTTP/1.1 500 Internal Server Error'); try { \wcf\functions\exception\printThrowable($e); } catch (\Throwable $e2) { diff --git a/wcfsetup/install/files/proxy_sourcemap.php b/wcfsetup/install/files/proxy_sourcemap.php index c3786532be..cc05afde18 100644 --- a/wcfsetup/install/files/proxy_sourcemap.php +++ b/wcfsetup/install/files/proxy_sourcemap.php @@ -149,7 +149,7 @@ function handle(ServerRequestInterface $request): ResponseInterface $body = new Stream(\fopen($cacheFilename, 'r')); if ($body->getSize() === 0) { - return new TextResponse('Failed to download the source map.', 503); + return new TextResponse('Failed to download the source map.', 500); } return new Response( -- 2.20.1