Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(compress): support zstd compression#791

Merged
vicky-run merged 4 commits intoopenGemini:mainfrom
xkx9431:xkx/compress_zstd
Nov 20, 2024
Merged

feat(compress): support zstd compression#791
vicky-run merged 4 commits intoopenGemini:mainfrom
xkx9431:xkx/compress_zstd

Conversation

@xkx9431
Copy link
Contributor

@xkx9431 xkx9431 commented Nov 10, 2024

What problem does this PR solve?

Issue Number: close/fix/resolve/ref #775

What is changed and how it works?

  1. The file has been renamed from gzip.go to "handler_compress.go"
  2. Refactored the lazyResponseGzipWriter into an abstract lazyCompressResponseWriter
  3. Introduced a FixedCachePool

When client query with http header ``"Accept-Encoding: "zstd"), then we change use the zstd compressor to encode the response

How Has This Been Tested?

In client sdk go side, this works fine with the example
image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@xkx9431 xkx9431 changed the title feat(compress): enable config the zstd compressor for encoding response feat: enable config the zstd compressor for encoding response Nov 11, 2024
@xkx9431 xkx9431 changed the title feat: enable config the zstd compressor for encoding response @WIP feat: enable config the zstd compressor for encoding response Nov 12, 2024
@xkx9431 xkx9431 changed the title @WIP feat: enable config the zstd compressor for encoding response feat: enable config the zstd compressor for encoding response Nov 14, 2024
@xkx9431 xkx9431 requested a review from fx408 November 14, 2024 14:05
@xkx9431 xkx9431 marked this pull request as draft November 14, 2024 14:10
@xkx9431 xkx9431 marked this pull request as ready for review November 14, 2024 14:11
@xkx9431 xkx9431 changed the title feat: enable config the zstd compressor for encoding response feat(compress): enable config the zstd compressor for encoding response Nov 15, 2024
@xkx9431 xkx9431 changed the title feat(compress): enable config the zstd compressor for encoding response feat (compress): enable config the zstd compressor for encoding response Nov 15, 2024
@xkx9431 xkx9431 changed the title feat (compress): enable config the zstd compressor for encoding response feat(compress): enable config the zstd compressor for encoding response Nov 15, 2024
@xkx9431 xkx9431 changed the title feat(compress): enable config the zstd compressor for encoding response feat(compress): enable config the zstd compressor for encoding response Nov 15, 2024
@xkx9431 xkx9431 changed the title feat(compress): enable config the zstd compressor for encoding response feat(compress): support more compression configs Nov 15, 2024
@xkx9431 xkx9431 changed the title feat(compress): support more compression configs feat(compress): support config zstd compression Nov 15, 2024
@xkx9431 xkx9431 changed the title feat(compress): support config zstd compression feat(compress): add zstd compression support Nov 15, 2024
@xkx9431 xkx9431 changed the title feat(compress): add zstd compression support feat(compress): support zstd compression Nov 15, 2024
@xkx9431 xkx9431 changed the title feat(compress): support zstd compression feat(compress): support zstd compression Nov 15, 2024
@xkx9431 xkx9431 requested a review from fx408 November 15, 2024 07:38
@xkx9431 xkx9431 changed the title feat(compress): support zstd compression feat(compress): support zstd compression Nov 18, 2024
@xkx9431 xkx9431 changed the title feat(compress): support zstd compression feat(compress): support zstd compression for http content Nov 18, 2024
@xkx9431 xkx9431 changed the title feat(compress): support zstd compression for http content feat(compress): support zstd compression Nov 18, 2024
@vicky-run vicky-run merged commit 6c94439 into openGemini:main Nov 20, 2024
hezhangjian pushed a commit that referenced this pull request Nov 21, 2024
<!-- Thank you for contributing to openGemini! -->

<!-- Mark the checkbox [X] or [x] if you agree with the item. -->

### What problem does this PR solve?
<!--

Please create an issue first to describe the problem.

There MUST be one line starting with "Issue Number:  " and
linking the relevant issues via the "close","fix", "resolve" or "ref".
-->

Issue Number: fix #791 

### What is changed and how it works?

Prior to the PR, there were two issues:
1. We should use the HTTP header **Accept-Encoding** instead of content-encoding to determine the compressor.

## Todo
  - [ ]  we also need to consider the content negotiation if http headers contains a list of accept encoding suits.


### How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [x] Unit Test 
- [x] Integration Test 
- [ ] Test cases to be added
- [ ] No code

## validation
![image](https://github.com/user-attachments/assets/ee189ee7-5776-4f17-b4c2-9a6882f57e9f)


# Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

Signed-off-by: xkx <[email protected]>
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.

6 participants