[HttpFoundation] Added the ability of mapping stream wrapper protocols when using X-Sendfile

This commit is contained in:
Sander-Toonen 2014-12-31 11:59:18 +01:00 committed by Jakub Zalas
parent dd129b71e3
commit 1da3d616a3

View File

@ -192,6 +192,10 @@ class BinaryFileResponse extends Response
// Use X-Sendfile, do not send any content.
$type = $request->headers->get('X-Sendfile-Type');
$path = $this->file->getRealPath();
// Fall back to scheme://path for stream wrapped locations.
if (false === $path) {
$path = $this->file->getPathname();
}
if (strtolower($type) == 'x-accel-redirect') {
// Do X-Accel-Mapping substitutions.
// @link http://wiki.nginx.org/X-accel#X-Accel-Redirect