clj-commons / clj-commons/aleph
Treat de/compression asymmetrically in H2
- Dominant language
- Clojure
- Stars
- 2.6k
- Forks
- 242
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 1
Description
## About
Because the H2 code has better reuse between server and client, turning on compression currently enables compression, decompression, and negotiation in both directions. However, they are fundamentally asymmetrical, and the defaults should reflect that.
The server should not default to decompressing requests, for both pragmatic and security reasons. Explicit support should be fine, though. Likewise, the client should not default to compressing requests.
## Earlier conversation
The `h2-compression-handler` is about parsing the client's "accept-encoding" header to determine what encoding to return. In theory, this could be symmetrical, and clients could encode their bodies, but for pragmatic and security reasons, client request body encoding isn't a thing, and we should change the code to make it clearer that it's server-only, and prevent misuse. (E.g., rename the keys, update AlephHttp2FrameCodecBuilder to compress or decompress, but not both simultaneously, etc.) You don't have to do that in this PR, though I think maybe I should update the key names before we do a full release of 0.7.0.
_Originally posted by @KingMob in https://github.com/clj-commons/aleph/issues/683#issuecomment-1867421349_
Contributor guide
Research direction
Start with the h2-compression-handler and AlephHttp2FrameCodecBuilder references in the issue, then trace how compression and decompression defaults are applied for server and client directions. Confirm that server request decompression and client request compression are disabled by default while explicit support remains; clarify whether renaming keys and preventing simultaneous modes are in scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- backend-api-design, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100