8000 merged branch fabpot/request-uti-fix (PR #6966) · symfony/symfony@4b30ae6 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 4b30ae6

Browse files
committed
merged branch fabpot/request-uti-fix (PR #6966)
This PR was merged into the 2.0 branch. Commits ------- ddf4678 [HttpFoundation] fixed the creation of sub-requests under some circumstancies (closes #6923, closes #6936) Discussion ---------- [HttpFoundation] fixed the creation of sub-requests under some circumstancies (closes #6923, closes #6936) | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #6923, #6936 | License | MIT | Doc PR | n/a This fixes the creation of a sub-request when the master request Request URI is determined with specific server information.
2 parents 1eab515 + ddf4678 commit 4b30ae6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Symfony/Component/HttpFoundation/Request.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,12 +1201,16 @@ protected function prepareRequestUri()
12011201
if ($this->headers->has('X_ORIGINAL_URL') && false !== stripos(PHP_OS, 'WIN')) {
12021202
// IIS with Microsoft Rewrite Module
12031203
$requestUri = $this->headers->get('X_ORIGINAL_URL');
1204+
$this->headers->remove('X_ORIGINAL_URL');
12041205
} elseif ($this->headers->has('X_REWRITE_URL') && false !== stripos(PHP_OS, 'WIN')) {
12051206
// IIS with ISAPI_Rewrite
12061207
$requestUri = $this->headers->get('X_REWRITE_URL');
1208+
$this->headers->remove('X_REWRITE_URL');
12071209
} elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') {
12081210
// IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
12091211
$requestUri = $this->server->get('UNENCODED_URL');
1212+
$this->server->remove('UNENCODED_URL');
1213+
$this->server->remove('IIS_WasUrlRewritten');
12101214
} elseif ($this->server->has('REQUEST_URI')) {
12111215
$requestUri = $this->server->get('REQUEST_URI');
12121216
// HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
@@ -1220,8 +1224,12 @@ protected function prepareRequestUri()
12201224
if ($this->server->get('QUERY_STRING')) {
12211225
$requestUri .= '?'.$this->server->get('QUERY_STRING');
12221226
}
1227+
$this->server->remove('ORIG_PATH_INFO');
12231228
}
12241229

1230+
// normalize the request URI to ease creating sub-requests from this request
1231+
$this->server->set('REQUEST_URI', $requestUri);
1232+
12251233
return $requestUri;
12261234
}
12271235

0 commit comments

Comments
 (0)
0