Merge branch 'MDL-83391-main' of https://github.com/cwarwicker/moodle

This commit is contained in:
Andrew Nicols 2024-11-21 10:51:52 +08:00
commit 3d24572e55
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14

View File

@ -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