mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Shift REQUEST_URI mangling into HTTPRequestBuilder::createFromVariables()
This commit is contained in:
parent
199d607a2c
commit
3e6984d5a8
@ -32,7 +32,13 @@ class HTTPRequestBuilder
|
|||||||
*/
|
*/
|
||||||
public static function createFromVariables(array $variables, $input)
|
public static function createFromVariables(array $variables, $input)
|
||||||
{
|
{
|
||||||
$url = $variables['_SERVER']['REQUEST_URI'];
|
// Remove query parameters (they're retained separately through $server['_GET']
|
||||||
|
$url = parse_url($variables['_SERVER']['REQUEST_URI'], PHP_URL_PATH);
|
||||||
|
|
||||||
|
// Remove base folders from the URL if webroot is hosted in a subfolder
|
||||||
|
if (substr(strtolower($url), 0, strlen(BASE_URL)) === strtolower(BASE_URL)) {
|
||||||
|
$url = substr($url, strlen(BASE_URL));
|
||||||
|
}
|
||||||
|
|
||||||
// Build request
|
// Build request
|
||||||
$request = new HTTPRequest(
|
$request = new HTTPRequest(
|
||||||
@ -124,17 +130,6 @@ class HTTPRequestBuilder
|
|||||||
(array)$variables['_COOKIE']
|
(array)$variables['_COOKIE']
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove query parameters (they're retained separately through $server['_GET']
|
|
||||||
$url = parse_url($variables['_SERVER']['REQUEST_URI'], PHP_URL_PATH);
|
|
||||||
|
|
||||||
// Remove base folders from the URL if webroot is hosted in a subfolder
|
|
||||||
if (substr(strtolower($url), 0, strlen(BASE_URL)) === strtolower(BASE_URL)) {
|
|
||||||
$url = substr($url, strlen(BASE_URL));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalise URI
|
|
||||||
$variables['_SERVER']['REQUEST_URI'] = $url;
|
|
||||||
|
|
||||||
return $variables;
|
return $variables;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user