Skip to content

Commit 524a582

Browse files
authored
fix: swoole file streaming (#842)
1 parent 96ea5b6 commit 524a582

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Swoole/SwooleClient.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Laravel\Octane\Octane;
1212
use Laravel\Octane\OctaneResponse;
1313
use Laravel\Octane\RequestContext;
14+
use ReflectionClass;
1415
use Swoole\Http\Response as SwooleResponse;
1516
use Symfony\Component\HttpFoundation\BinaryFileResponse;
1617
use Symfony\Component\HttpFoundation\Response;
@@ -201,7 +202,10 @@ public function sendResponseHeaders(Response $response, SwooleResponse $swooleRe
201202
protected function sendResponseContent(OctaneResponse $octaneResponse, SwooleResponse $swooleResponse): void
202203
{
203204
if ($octaneResponse->response instanceof BinaryFileResponse) {
204-
$swooleResponse->sendfile($octaneResponse->response->getFile()->getPathname());
205+
$swooleResponse->sendfile(
206+
$octaneResponse->response->getFile()->getPathname(),
207+
(new ReflectionClass(BinaryFileResponse::class))->getProperty('offset')->getValue($octaneResponse->response)
208+
);
205209

206210
return;
207211
}

0 commit comments

Comments
 (0)