Skip to content

Commit 5f10119

Browse files
Merge branch '4.0' into 4.1
* 4.0: [HttpFoundation] Remove support for legacy and risky HTTP headers
2 parents da12951 + e5a8475 commit 5f10119

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+
4.1.3
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
4.1.0
511
-----
612

Request.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -1688,18 +1688,7 @@ protected function prepareRequestUri()
16881688
{
16891689
$requestUri = '';
16901690

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

Tests/RequestTest.php

-44
Original file line numberDiff line numberDiff line change
@@ -1837,52 +1837,8 @@ public function iisRequestUriProvider()
18371837
{
18381838
return array(
18391839
array(
1840-
array(
1841-
'X_ORIGINAL_URL' => '/foo/bar',
1842-
),
1843-
array(),
1844-
'/foo/bar',
1845-
),
1846-
array(
1847-
array(
1848-
'X_REWRITE_URL' => '/foo/bar',
1849-
),
18501840
array(),
1851-
'/foo/bar',
1852-
),
1853-
array(
1854-
array(),
1855-
array(
1856-
'IIS_WasUrlRewritten' => '1',
1857-
'UNENCODED_URL' => '/foo/bar',
1858-
),
1859-
'/foo/bar',
1860-
),
1861-
array(
1862-
array(
1863-
'X_ORIGINAL_URL' => '/foo/bar',
1864-
),
1865-
array(
1866-
'HTTP_X_ORIGINAL_URL' => '/foo/bar',
1867-
),
1868-
'/foo/bar',
1869-
),
1870-
array(
1871-
array(
1872-
'X_ORIGINAL_URL' => '/foo/bar',
1873-
),
1874-
array(
1875-
'IIS_WasUrlRewritten' => '1',
1876-
'UNENCODED_URL' => '/foo/bar',
1877-
),
1878-
'/foo/bar',
1879-
),
1880-
array(
1881-
array(
1882-
'X_ORIGINAL_URL' => '/foo/bar',
1883-
),
18841841
array(
1885-
'HTTP_X_ORIGINAL_URL' => '/foo/bar',
18861842
'IIS_WasUrlRewritten' => '1',
18871843
'UNENCODED_URL' => '/foo/bar',
18881844
),

0 commit comments

Comments
 (0)