Skip to content

Commit

Permalink
fix: swoole file streaming (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
L3o-pold authored Feb 23, 2024
1 parent 96ea5b6 commit 524a582
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Swoole/SwooleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Laravel\Octane\Octane;
use Laravel\Octane\OctaneResponse;
use Laravel\Octane\RequestContext;
use ReflectionClass;
use Swoole\Http\Response as SwooleResponse;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -201,7 +202,10 @@ public function sendResponseHeaders(Response $response, SwooleResponse $swooleRe
protected function sendResponseContent(OctaneResponse $octaneResponse, SwooleResponse $swooleResponse): void
{
if ($octaneResponse->response instanceof BinaryFileResponse) {
$swooleResponse->sendfile($octaneResponse->response->getFile()->getPathname());
$swooleResponse->sendfile(
$octaneResponse->response->getFile()->getPathname(),
(new ReflectionClass(BinaryFileResponse::class))->getProperty('offset')->getValue($octaneResponse->response)
);

return;
}
Expand Down

0 comments on commit 524a582

Please sign in to comment.