19 declare(strict_types=1);
31 private readonly \
ilHTTPS $https,
39 $protocol =
'http://';
40 if ($this->https->isDetected()) {
41 $protocol =
'https://';
43 $host = $this->server_data[
'HTTP_HOST'];
44 $request_uri = strip_tags($this->server_data[
'REQUEST_URI']);
48 if (\is_int($pos = strpos($request_uri,
'?'))) {
49 $request_uri = substr($request_uri, 0, $pos);
52 if (\defined(
'ILIAS_MODULE')) {
54 $path = \dirname($request_uri);
59 $dirs = explode(
'/', $module);
61 $uri = \dirname($uri, \count($dirs));
63 $path = pathinfo($request_uri);
64 if ((
$path[
'extension'] ??
'') !==
'') {
65 $uri = \dirname($request_uri);
74 $ilias_http_path = preg_replace(
'@(http|https)(://)(.*?/.*?\.php).*@',
'$1$2$3', $ilias_http_path);
75 $ilias_http_path = preg_replace(
'@goto.php/$@',
'', $ilias_http_path);
76 $ilias_http_path = preg_replace(
'/goto.php$/',
'', $ilias_http_path);
77 $ilias_http_path = preg_replace(
'@go/.*$@',
'', $ilias_http_path);
81 $ini_uri = $this->df->uri($this->ini->readVariable(
'server',
'http_path'));
87 if ($this->
settings->get(
'soap_wsdl_path')) {
88 $soap_wsdl_uri = $this->df->uri($this->
settings->get(
'soap_wsdl_path'));
89 $allowed_hosts = array_merge(
90 [$soap_wsdl_uri->getHost()],
95 $allowed_hosts = array_merge(
96 array_filter(explode(
',', $this->
settings->get(
'allowed_hosts',
''))),
100 if (!\in_array($uri->getHost(), $allowed_hosts,
true)) {
101 throw new \RuntimeException(
'Request rejected, the given HTTP host is not in the "allowed_hosts" list');
Interface Observer Contains several chained tasks and infos about them.
static modifyHttpPath(string $httpPath)
static removeTrailingPathSeparators(string $path)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(private readonly \ILIAS\Data\Factory $df, private readonly \ilSetting $settings, private readonly \ilHTTPS $https, private readonly \ilIniFile $ini, private readonly array|\ArrayAccess $server_data)