Repository: laravel/octane (language: php)

Issue:
Swoole in HTTP/2 mode is incompatible with chunking large responses in `SwooleClient`
### 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}
```

![image](https://github.com/laravel/octane/assets/2048674/6c69ad6e-cc11-4d7a-9e80-0e5ce634ed7f)

![image](https://github.com/laravel/octane/assets/2048674/680f2202-ac29-4697-baca-c338efd70ede)



### Steps To Reproduce

Routes:

![image](https://github.com/laravel/octane/assets/2048674/e48e1db2-ff1c-4034-9760-c22ccaf23d1a)

`octane.php` Swoole config:

![image](https://github.com/laravel/octane/assets/2048674/df687e07-41d9-4aaa-bc7e-e6212a4705f6)




Discussion / hints:
@sy-records would you perhaps have some time to look into this one? Greatly appreciated 🙏 

Fix patch:
diff --git a/src/Swoole/SwooleClient.php b/src/Swoole/SwooleClient.php
index ba4443b5e..486d129af 100644
--- a/src/Swoole/SwooleClient.php
+++ b/src/Swoole/SwooleClient.php
@@ -240,7 +240,7 @@ protected function sendResponseContent(OctaneResponse $octaneResponse, SwooleRes
             return;
         }
 
-        if ($length <= $this->chunkSize) {
+        if ($length <= $this->chunkSize || config('octane.swoole.options.open_http2_protocol', false)) {
             $swooleResponse->end($content);
 
             return;


Test patch: