Merge branch '4.1'

* 4.1:
  [HttpFoundation] X-Accel-Mapping does not use HTTP key=value syntax
This commit is contained in:
Fabien Potencier 2018-09-30 05:50:33 +02:00
commit ae755d09ea
2 changed files with 4 additions and 3 deletions

View File

@ -219,8 +219,8 @@ class BinaryFileResponse extends Response
// Do X-Accel-Mapping substitutions.
// @link http://wiki.nginx.org/X-accel#X-Accel-Redirect
$parts = HeaderUtils::split($request->headers->get('X-Accel-Mapping', ''), ',=');
$mappings = HeaderUtils::combine($parts);
foreach ($mappings as $pathPrefix => $location) {
foreach ($parts as $part) {
list($pathPrefix, $location) = $part;
if (substr($path, 0, \strlen($pathPrefix)) === $pathPrefix) {
$path = $location.substr($path, \strlen($pathPrefix));
break;

View File

@ -337,7 +337,8 @@ class BinaryFileResponseTest extends ResponseTestCase
{
return array(
array('/var/www/var/www/files/foo.txt', '/var/www/=/files/', '/files/var/www/files/foo.txt'),
array('/home/foo/bar.txt', '/var/www/=/files/,/home/foo/=/baz/', '/baz/bar.txt'),
array('/home/Foo/bar.txt', '/var/www/=/files/,/home/Foo/=/baz/', '/baz/bar.txt'),
array('/home/Foo/bar.txt', '"/var/www/"="/files/", "/home/Foo/"="/baz/"', '/baz/bar.txt'),
);
}