Skip to content
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: utopia compression #146

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

feat: utopia compression #146

wants to merge 21 commits into from

Conversation

loks0n
Copy link

@loks0n loks0n commented Oct 16, 2024

Adds setCompression configuration method to utopia Http

If enabled, this performs brotli, gzip, or delate (in decreasing priority) compression on response bodies of requests that:

  • have a whitelisted mime-type (text/* etc)
  • AND are greater than 1KB
  • AND have accept-encoding header

@loks0n loks0n requested a review from eldadfux October 16, 2024 11:13
@loks0n loks0n changed the title feat: utopia compression WIP: feat: utopia compression Oct 16, 2024
@loks0n loks0n changed the title WIP: feat: utopia compression feat: utopia compression Oct 16, 2024
@loks0n loks0n marked this pull request as draft October 16, 2024 11:14
@loks0n loks0n marked this pull request as ready for review October 17, 2024 12:45
src/Http/Response.php Outdated Show resolved Hide resolved
@loks0n loks0n requested a review from eldadfux October 23, 2024 09:55
composer.json Outdated
Comment on lines 36 to 40
"repositories": {
"utopia-php/compression": {
"type": "git",
"url": "https://github.com/utopia-php/compression"
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed now that the package was published.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the filename/location is not consistent with what we do in other utopia libs. Maybe we can use the database library or something else for a pattern we can reuse here.

Copy link
Author

@loks0n loks0n Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you like this?

tests/
    e2e/
        Server/
            SwooleTest.php
            FPMTest.php
            SwooleCompressionTest.php
            ...
            resources/
                init.php
                SwooleServer.php
                FPMServer.php
                SwooleCompressionServer.php
                ... 

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

Successfully merging this pull request may close these issues.

2 participants