Skip to content

permessage-deflate - #43

Draft
willrnch wants to merge 5 commits into
denoland:mainfrom
willrnch:main
Draft

permessage-deflate#43
willrnch wants to merge 5 commits into
denoland:mainfrom
willrnch:main

Conversation

@willrnch

@willrnch willrnch commented Aug 2, 2023

Copy link
Copy Markdown

No description provided.

@willrnch
willrnch marked this pull request as draft August 2, 2023 14:22
@willrnch willrnch mentioned this pull request Aug 2, 2023
@spy16x

spy16x commented Jun 27, 2025

Copy link
Copy Markdown

What is the state of this implementation?

(I have built a websocket server for some production use-case with this lib. The clients are in flutter. Now I'm seeing a bunch of errors like ReservedBitsNotZero, InvalidValue while reading from the socket. My guess is, the client is doing compression 😅 I'm worried now that this doesn't have support yet).

@pboft

pboft commented Oct 31, 2025

Copy link
Copy Markdown

What is the state of this implementation?

(I have built a websocket server for some production use-case with this lib. The clients are in flutter. Now I'm seeing a bunch of errors like ReservedBitsNotZero, InvalidValue while reading from the socket. My guess is, the client is doing compression 😅 I'm worried now that this doesn't have support yet).

I am seeing these too "ReservedBitsNotZero, InvalidValue while reading from the socket.". Originally, I believe it to be due to client-side deflate compression, however, strangely inspecting the raw packets in wireshark showed no set bits.

Regardless - what is required to help get this PR over the line ?

Also, is "ReservedBitsNotZero, InvalidValue while reading from the socket.". definitely not a parsing/decoding bug from the underlying library framing?

Thanks

@spy16x

spy16x commented Oct 31, 2025

Copy link
Copy Markdown

@pboft

The socket read/write are not cancellation safe. So if you're using them with tokio::select! or something it can cause partial frame reads and corrupt the whole stream.

This is what was happening in my case. Not related to compression.

I'd suggest you check this in your usecase too.

@pboft

pboft commented Nov 3, 2025

Copy link
Copy Markdown

@pboft

The socket read/write are not cancellation safe. So if you're using them with tokio::select! or something it can cause partial frame reads and corrupt the whole stream.

This is what was happening in my case. Not related to compression.

I'd suggest you check this in your usecase too.

That's super helpful, sounds like it's exactly what might be happening. I'll check that out ASAP.

@willrnch

Copy link
Copy Markdown
Author

What is the state of this implementation?

The current implementation support the most basic case and will inflate the message sent by the client if needed.
There is no protocol negotiation whatsoever so none of the extension parameters are supported (i.e. the server will not deflate any message, context takeover cannot be disabled and LZ77 sliding window size cannot be configured).

I'm working on protocol negotiation and will try to push soon.

@EvolveArt

Copy link
Copy Markdown

What is the state of this implementation?

The current implementation support the most basic case and will inflate the message sent by the client if needed. There is no protocol negotiation whatsoever so none of the extension parameters are supported (i.e. the server will not deflate any message, context takeover cannot be disabled and LZ77 sliding window size cannot be configured).

I'm working on protocol negotiation and will try to push soon.

hey @willrnch any update on this? happy to help

@algtm

algtm commented May 12, 2026

Copy link
Copy Markdown

ping

@willrnch

willrnch commented Aug 23, 2026

Copy link
Copy Markdown
Author

I've made some significant progress:

  • Basic protocol negotiation
  • Server frame compression
  • Disable context takeover
  • Configure LZ77 sliding window size
  • Complex protocol negotiation (Need to handle more complex cases defined in the RFC: parameter selection)
  • Support fragmented messages
  • Fix frame header parsing
  • Handle upgrade in IncomingUpgrade::upgrade and from_request_parts (not sure this is needed)
  • Handle LZ77 sliding window size negotiation if the flate2 backend doesn't support it (via crate feature)
  • autobahn test

@willrnch
willrnch force-pushed the main branch 2 times, most recently from 440504d to 01e1b5e Compare August 23, 2026 20:03
@willrnch
willrnch force-pushed the main branch 2 times, most recently from e804cfb to 5060586 Compare September 4, 2026 19:41
@willrnch

willrnch commented Sep 4, 2026

Copy link
Copy Markdown
Author
  • Basic protocol negotiation
  • Server frame compression
  • Disable context takeover
  • Configure LZ77 sliding window size
  • Complex protocol negotiation (Need to handle more complex cases defined in the RFC: parameter selection)
  • Support fragmented messages
  • Fix frame header parsing
  • Handle upgrade in IncomingUpgrade::upgrade and from_request_parts (not sure this is needed)
  • Handle LZ77 sliding window size negotiation if the flate2 backend doesn't support it (via crate feature)
  • autobahn test

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.

5 participants