-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenSwoole: Streamed response adds invalid "Transfer-Encoding: chunked" header #568
Comments
As a temporary fix, I removed the Route::get('/download', static function (FilesystemManager $filesystem) {
return $filesystem->disk('local')->download(
'public/test.jpg',
'test-download.jpg',
- ['Content-Type' => 'image/jpeg']
+ ['Content-Type' => 'image/jpeg', 'Content-Length' => null]
);
}); This precludes Laravel from setting its own |
Taking a look at this next week. |
Sorry, but the fact that this issue only exists on Swoole, and not on RoadRunner / Regular Nginx, tells me that this is an issue with Swoole itself. Please reach out to the authors library here: https://github.com/swoole/swoole-src/issues. |
@nunomaduro understandable. Might you have any pointers for me which OpenSwoole APIs Laravel uses? I'm a bit into the code, but not that deep. |
The same situation occurs with swoole (tested with 4.8.10 and 5.0.0), octane 1.3 and it also occurs with not streamed responses with explicit
|
It seems to be a bad behaviour of The following test sample using $http->on('Request', function (Request $request, Response $response) {
$response->header('Content-Length', 5);
$response->write('Hello');
$response->end();
}); produces:
while sending content in $http->on('Request', function (Request $request, Response $response) {
$response->header('Content-Length', 5);
$response->end('Hello');
}); does not include
|
1.3.0
(current, see repro)9.26.1
(current, see repro)8.1.2
RoadRunner4.10.0Description:
When using Octane with the swoole integration, streaming downloads from the filesystem don't work with certain software because an illegal header combination is added to the response; as per RFC 2616, Section 4.4, the
Content-Length
andTransfer-Encoding
headers may not be used together:The following code sample demonstrates the issue:
This yields the following response:
As you can see, there's a
Content-Length
, and aTransfer-Encoding: chunked
header in the response. This causes nginx to throw up, for example (log entry from production):The issue does not occur with the RoadRunner server enabled. Also, this might be related to #109.
Steps To Reproduce:
See the reproduction repository:
matchory/laravel-octane-bug-report-transfer-encoding
composer install
php artisan octane:start
/download
endpoint, for example using cURL:The text was updated successfully, but these errors were encountered: