Description
Octane Version
2.3.7
Laravel Version
11.4.0
PHP Version
8.3.6
What server type are you using?
Swoole
Server Version
5.1.1
Database Driver & Version
No response
Description
When running Octane with Swoole (no reverse proxy in place) and the open_http2_protocol
option set to true
, responses larger than the chunk size 148576
defined in Laravel\Octane\Swoole\SwooleClient
cause an ErrorException
to be thrown by Swoole warning that the HTTP2 client does not not support HTTP-CHUNK
. Smaller responses work normally and are HTTP2 which is great.
You can see this check happening inside the swoole source https://github.com/swoole/swoole-src/blob/db5682748d8fef4dfc5c39b4d81328ebd346f5ad/ext-src/swoole_http_response.cc#L318
I couldn't find anywhere that you can access from within PHP to tell if a SwooleResponse
is going to be HTTP/2 but this could probably be fixed with a simple config check (example below) as a good enough solution.
If you need more info or a repro repo, happy to provide. Also happy to do the PR with a fix just thought someone should review the issue first in case I'm missing anything.
ErrorException: Swoole\Http\Response::write(): HTTP2 client does not support HTTP-CHUNK in /var/www/html/vendor/laravel/octane/src/Swoole/SwooleClient.php:252
Stack trace:
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
#2 /var/www/html/vendor/laravel/octane/src/Swoole/SwooleClient.php(252): Swoole\Http\Response->write()
#3 /var/www/html/vendor/laravel/octane/src/Swoole/SwooleClient.php(146): Laravel\Octane\Swoole\SwooleClient->sendResponseContent()
#4 /var/www/html/vendor/laravel/octane/src/Worker.php(93): Laravel\Octane\Swoole\SwooleClient->respond()
#5 /var/www/html/vendor/laravel/octane/bin/swoole-server(120): Laravel\Octane\Worker->handle()
#6 [internal function]: {closure}()
#7 /var/www/html/vendor/laravel/octane/bin/swoole-server(170): Swoole\Server->start()
#8 {main}
Steps To Reproduce
Routes:
octane.php
Swoole config: