actix-web icon indicating copy to clipboard operation
actix-web copied to clipboard

Add support for `permessage-deflate` WebSocket extension

Open segfault87 opened this issue 1 year ago • 2 comments
trafficstars

PR Type

Feature

PR Checklist

  • [x] Tests for the changes have been added / updated.
  • [x] Documentation comments have been added / updated.
  • [x] A changelog entry has been made for the appropriate packages.
  • [x] Format code with the latest stable rustfmt.
  • [x] (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 avatar Nov 06 '24 13:11 segfault87