8000 [HttpFoundation] fixed the creation of sub-requests under some circum… · weaverryan/symfony@ddf4678 · GitHub
[go: up one dir, main page]

Skip to content

Commit ddf4678

Browse files
committed
[HttpFoundation] fixed the creation of sub-requests under some circumstancies (closes symfony#6923, closes symfony#6936)
This fixes the creation of a sub-request when the master request Request URI is determined with specific server information.
1 parent 1eab515 commit ddf4678

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