From 1da3d616a3f7f78a20d09a57329ff0d1231898e3 Mon Sep 17 00:00:00 2001 From: Sander-Toonen Date: Wed, 31 Dec 2014 11:59:18 +0100 Subject: [PATCH] [HttpFoundation] Added the ability of mapping stream wrapper protocols when using X-Sendfile --- src/Symfony/Component/HttpFoundation/BinaryFileResponse.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php index 69afbe1c84..d20880fceb 100644 --- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php +++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php @@ -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