-
Notifications
You must be signed in to change notification settings - Fork 296
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
feat: enable http compression by sending data not with chunked encodi… #691
Conversation
f704623
to
3c0046e
Compare
Can you add tests on this please? |
13b7fc1
to
27e6ac3
Compare
Two tests have been added:
|
Has conflicts. |
Please mark as ready for review when fixed. |
27e6ac3
to
713a4ac
Compare
@taylorotwell conflict resolved - thx |
THX @taylorotwell |
This change contains a breaking change for us. Currently we are GZIP encoding responses with the below code and with this change the server returns malformed responses. For now I've locked our Octane version to 1.5.4, what would be the recommended way to GZIP encode responses? I don't want to add an extra layer e.g. Nginx just to encode the response.
|
swoole has built in compression capabilities - see the link in the description of this pr. as long as compiled with the correct options it will work out of the box and there is no need for extra code |
@DeepDiver1975 thanks for explaining, that makes sense. I did try to get the automatic compression working with the official Swoole docker image (using this one currently) but didn't have any joy so ended up doing it within Laravel. I thought it was probably a combination of http_compression not being set to true within Octane and the way the Docker image has been setup. |
With a bit of messing around managed to get Brotli and Gzip working thanks to this change. You're right about the correct packages (libz/brotli) needing to be installed before Swoole is installed. |
…ng - if possible
http compression can only be used if chunked encoding is not used.
Therefore if the response body "fits into one chunk"
end()
is called instead ofwrite()
followed byend()
refs: https://openswoole.com/docs/modules/swoole-http-server/configuration#http_compression
Applies to swoole as well