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.
This commit is contained in:
commit
4b30ae66d5
@ -1201,12 +1201,16 @@ class Request
|
||||
if ($this->headers->has('X_ORIGINAL_URL') && false !== stripos(PHP_OS, 'WIN')) {
|
||||
// IIS with Microsoft Rewrite Module
|
||||
$requestUri = $this->headers->get('X_ORIGINAL_URL');
|
||||
$this->headers->remove('X_ORIGINAL_URL');
|
||||
} elseif ($this->headers->has('X_REWRITE_URL') && false !== stripos(PHP_OS, 'WIN')) {
|
||||
// IIS with ISAPI_Rewrite
|
||||
$requestUri = $this->headers->get('X_REWRITE_URL');
|
||||
$this->headers->remove('X_REWRITE_URL');
|
||||
} elseif ($this->server->get('IIS_WasUrlRewritten') == '1' && $this->server->get('UNENCODED_URL') != '') {
|
||||
// IIS7 with URL Rewrite: make sure we get the unencoded url (double slash problem)
|
||||
$requestUri = $this->server->get('UNENCODED_URL');
|
||||
$this->server->remove('UNENCODED_URL');
|
||||
$this->server->remove('IIS_WasUrlRewritten');
|
||||
} elseif ($this->server->has('REQUEST_URI')) {
|
||||
$requestUri = $this->server->get('REQUEST_URI');
|
||||
// HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path
|
||||
@ -1220,8 +1224,12 @@ class Request
|
||||
if ($this->server->get('QUERY_STRING')) {
|
||||
$requestUri .= '?'.$this->server->get('QUERY_STRING');
|
||||
}
|
||||
$this->server->remove('ORIG_PATH_INFO');
|
||||
}
|
||||
|
||||
// normalize the request URI to ease creating sub-requests from this request
|
||||
$this->server->set('REQUEST_URI', $requestUri);
|
||||
|
||||
return $requestUri;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user