From 4235b18a889cd9d1b306ea410ed8e8ec307730c1 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 27 Oct 2016 14:46:28 +0200 Subject: allow passing a stream to StreamResponse Signed-off-by: Robin Appelman --- lib/private/AppFramework/Http/Output.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/private/AppFramework/Http') diff --git a/lib/private/AppFramework/Http/Output.php b/lib/private/AppFramework/Http/Output.php index 85f0e6f8feb..1d77350b1a2 100644 --- a/lib/private/AppFramework/Http/Output.php +++ b/lib/private/AppFramework/Http/Output.php @@ -48,12 +48,17 @@ class Output implements IOutput { } /** - * @param string $path + * @param string|resource $path or file handle * * @return bool false if an error occurred */ public function setReadfile($path) { - return @readfile($path); + if (is_resource($path)) { + $output = fopen('php://output', 'w'); + return stream_copy_to_stream($path, $output) > 0; + } else { + return @readfile($path); + } } /** -- cgit v1.2.3