Skip to content

Commit 5097611

Browse files
[HttpFoundation] Remove support for legacy and risky HTTP headers
1 parent 0850b48 commit 5097611

File tree

3 files changed

+7
-56
lines changed

3 files changed

+7
-56
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
2.8.44
5+
------
6+
7+
* [BC BREAK] Support for the IIS-only `X_ORIGINAL_URL` and `X_REWRITE_URL`
8+
HTTP headers has been dropped for security reasons.
9+
410
2.8.0
511
-----
612

Request.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -1691,18 +1691,7 @@ protected function prepareRequestUri()
16911691
{
16921692
$requestUri = '';
16931693

1694-
if ($this->headers->has('X_ORIGINAL_URL')) {
1695-
// IIS with Microsoft Rewrite Module
1696-
$requestUri = $this->headers->get('X_ORIGINAL_URL');
1697-
$this->headers->remove('X_ORIGINAL_URL');
1698-
$this->server->remove('HTTP_X_ORIGINAL_URL');
1699-
$this->server->remove('UNENCODED_URL');
1700-
$this->server->remove('IIS_WasUrlRewritten');
1701-
} elseif ($this->headers->has('X_REWRITE_URL')) {
1702-
// IIS with ISAPI_Rewrite
1703-
$requestUri = $this->headers->get('X_REWRITE_URL');
1704-
$this->headers->remove('X_REWRITE_URL');
1705-
} elseif ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $this->server->get('UNENCODED_URL')) {
1694+
if ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $this->server->get('UNENCODED_URL')) {
17061695
// IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem)
17071696
$requestUri = $this->server->get('UNENCODED_URL');
17081697
$this->server->remove('UNENCODED_URL');

Tests/RequestTest.php

-44
Original file line numberDiff line numberDiff line change
@@ -1809,52 +1809,8 @@ public function iisRequestUriProvider()
18091809
{
18101810
return array(
18111811
array(
1812-
array(
1813-
'X_ORIGINAL_URL' => '/foo/bar',
1814-
),
1815-
array(),
1816-
'/foo/bar',
1817-
),
1818-
array(
1819-
array(
1820-
'X_REWRITE_URL' => '/foo/bar',
1821-
),
18221812
array(),
1823-
'/foo/bar',
1824-
),
1825-
array(
1826-
array(),
1827-
array(
1828-
'IIS_WasUrlRewritten' => '1',
1829-
'UNENCODED_URL' => '/foo/bar',
1830-
),
1831-
'/foo/bar',
1832-
),
1833-
array(
1834-
array(
1835-
'X_ORIGINAL_URL' => '/foo/bar',
1836-
),
1837-
array(
1838-
'HTTP_X_ORIGINAL_URL' => '/foo/bar',
1839-
),
1840-
'/foo/bar',
1841-
),
1842-
array(
1843-
array(
1844-
'X_ORIGINAL_URL' => '/foo/bar',
1845-
),
1846-
array(
1847-
'IIS_WasUrlRewritten' => '1',
1848-
'UNENCODED_URL' => '/foo/bar',
1849-
),
1850-
'/foo/bar',
1851-
),
1852-
array(
1853-
array(
1854-
'X_ORIGINAL_URL' => '/foo/bar',
1855-
),
18561813
array(
1857-
'HTTP_X_ORIGINAL_URL' => '/foo/bar',
18581814
'IIS_WasUrlRewritten' => '1',
18591815
'UNENCODED_URL' => '/foo/bar',
18601816
),

0 commit comments

Comments
 (0)