From aa8c304af2f5d9e949a48d8860aba347d3bb694a Mon Sep 17 00:00:00 2001 From: Conn Warwicker Date: Tue, 8 Oct 2024 12:04:31 +0100 Subject: [PATCH] MDL-83391 core: Remove hard-coded "support" for webservers. This allows for more flexibility with web server software. --- lib/setuplib.php | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/lib/setuplib.php b/lib/setuplib.php index a67355e3a56..2d8559ea99f 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -845,41 +845,14 @@ function setup_get_remote_url() { } $_SERVER['REQUEST_URI'] = $rurl['fullpath']; // extra IIS compatibility -/* NOTE: following servers are not fully tested! */ - - } else if (stripos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false) { - //lighttpd - not officially supported - $rurl['fullpath'] = $_SERVER['REQUEST_URI']; // TODO: verify this is always properly encoded - } else if (stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) { - //nginx - not officially supported if (!isset($_SERVER['SCRIPT_NAME'])) { die('Invalid server configuration detected, please try to add "fastcgi_param SCRIPT_NAME $fastcgi_script_name;" to the nginx server configuration.'); } - $rurl['fullpath'] = $_SERVER['REQUEST_URI']; // TODO: verify this is always properly encoded - - } else if (stripos($_SERVER['SERVER_SOFTWARE'], 'cherokee') !== false) { - //cherokee - not officially supported - $rurl['fullpath'] = $_SERVER['REQUEST_URI']; // TODO: verify this is always properly encoded - - } else if (stripos($_SERVER['SERVER_SOFTWARE'], 'zeus') !== false) { - //zeus - not officially supported - $rurl['fullpath'] = $_SERVER['REQUEST_URI']; // TODO: verify this is always properly encoded - - } else if (stripos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false) { - //LiteSpeed - not officially supported - $rurl['fullpath'] = $_SERVER['REQUEST_URI']; // TODO: verify this is always properly encoded - - } else if ($_SERVER['SERVER_SOFTWARE'] === 'HTTPD') { - //obscure name found on some servers - this is definitely not supported - $rurl['fullpath'] = $_SERVER['REQUEST_URI']; // TODO: verify this is always properly encoded - - } else if (strpos($_SERVER['SERVER_SOFTWARE'], 'PHP') === 0) { - // built-in PHP Development Server $rurl['fullpath'] = $_SERVER['REQUEST_URI']; - } else { - throw new moodle_exception('unsupportedwebserver', 'error', '', $_SERVER['SERVER_SOFTWARE']); + // Any other servers we can assume will pass the request_uri normally. + $rurl['fullpath'] = $_SERVER['REQUEST_URI']; } // sanitize the url a bit more, the encoding style may be different in vars above