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

Add support for permessage-deflate WebSocket extension #3496

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

Conversation

segfault87
Copy link

@segfault87 segfault87 commented Nov 6, 2024

PR Type

Feature

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt.
  • (Team) Label with affected crates and semver status.

Overview

This PR implements DEFLATE compression (specifically permessage-deflate extension which defined at RFC 7692) support for WebSocket.
The whole feature is flagged behind compress-ws-deflate feature.
Currently, flate2 requires zlib for certain feature required by permessage-deflate extension. Therefore using this feature will introduce extra zlib dependency.

Also, Codec has been modified to split into Encoder and Decoder as there are some cases when encoding and decoding take place in different producer/consumers. Still its interface is unmodified in order to prevent API compatibility breakage.

A PR counterpart on actix-ws will follow.

@segfault87
Copy link
Author

On the idea of implementing the extension outside of actix-http, I elaborated a bit at this comment: actix/actix-extras#479 (comment)

Copy link
Contributor

@asonix asonix left a comment

Choose a reason for hiding this comment

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

There's a lot here but I think overall this looks good :) It's unfortunate that this is a breaking change to the public API in a few places. I'm not sure what the plan is for a new major version of actix-http/actix-web although I assume there's no immediate plans for such a release.

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