[HttpFoundation] X-Accel-Mapping does not use HTTP key=value syntax
This commit is contained in:
parent
0e47775d62
commit
09343c27d7
@ -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;
|
||||
|
@ -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'),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user