Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Add Gzip support on response chunk mode #456

Merged
merged 5 commits into from
Feb 22, 2021
Merged

Conversation

hezachary
Copy link
Contributor

Swoole does not support compress on chunk mode, related document: https://wiki.swoole.com/#/http_server?id=http_compression

The patch provide gzip for such needs.

A example is AWS load balance in many cases can replace server like apache or nginx. However, ALB does not provide compression. Once swoole in chunk mode, there almost no other choice but to add a web server in between.

  1. The patch checks Laravel/Lumen response header to avoid double compression
  2. Only gzip when client side provide "accept-encoding" header with gzip option
  3. Only gzip when Swoole config shows http_compression = true
  4. Also, it checks zlib gzencode is installed

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 68.095% when pulling 2911def on hezachary:master into 714cb6d on swooletw:master.

@coveralls
Copy link

coveralls commented Dec 4, 2020

Coverage Status

Coverage increased (+1.6%) to 69.948% when pulling b2da170 on hezachary:master into 714cb6d on swooletw:master.

@RodrigoGalter
Copy link

Any idea when this will be approved?

@Arkanius
Copy link
Contributor

I'm still reviewing it

@hezachary
Copy link
Contributor Author

I will add more test case to increase coverage today, at least for my code.

@hezachary
Copy link
Contributor Author

hezachary commented Dec 17, 2020

With the new test case, coverage for SwooleTW\Http\Transformers/\Response
Screen Shot 2020-12-17 at 1 43 47 pm

@hezachary
Copy link
Contributor Author

Is there anything I can do to improve the PR to help you @Arkanius approve it?

@Arkanius
Copy link
Contributor

Thank you @hezachary ! I think that is ok! I'm planning to release it at this week

@Arkanius Arkanius merged commit 5e80d23 into swooletw:master Feb 22, 2021
@Arkanius
Copy link
Contributor

@hezachary it's now release as v2.7.0

Thanks for your support!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants