Skip to content

Honor client_no_context_takeover offer#1194

Open
jhugard wants to merge 2 commits intozaphoyd:developfrom
jhugard:permessage-deflate-client-no-context-takeover
Open

Honor client_no_context_takeover offer#1194
jhugard wants to merge 2 commits intozaphoyd:developfrom
jhugard:permessage-deflate-client-no-context-takeover

Conversation

@jhugard
Copy link
Copy Markdown

@jhugard jhugard commented Apr 3, 2026

Problem (#1193)

In the default WebSocket++ permessage-deflate client configuration, the client offer generated by generate_offer() advertises client_no_context_takeover, but client-side compression behavior only honors that setting when the server echoes the parameter in its response. If the server accepts permessage-deflate and omits client_no_context_takeover, the client still reuses compressor context across messages.

This means the offer string and the actual outbound behavior can diverge.


Branch and commit series

  • Branch: permessage-deflate-client-no-context-takeover
  • Base: origin/develop

This branch contains two commits:

  1. b8e4b6fAdd client_no_context_takeover regression test
  2. 6ed4712Honor client_no_context_takeover offer

Overview of changes

The fix keeps track of whether the client advertised client_no_context_takeover in generate_offer() and carries that offer-side state into the client init(false) path.

With that state available at initialization time, the client uses no-context-takeover compression behavior for outbound messages even when the server omits client_no_context_takeover from the negotiated response parameters.


Tests

Added coverage in test/extension/permessage_deflate.cpp for the case where:

  • the client offer includes client_no_context_takeover
  • the server response attribute list is empty
  • the client compresses the same deterministic message twice
  • each compressed output is decompressed independently by a fresh server-side extension instance

Validation

Reviewer flow:

  1. check out b8e4b6f and run the new regression (expected to fail)
  2. apply 6ed4712 and rerun (expected to pass)

Observed behavior:

  • before the fix, the second compressed message depends on prior context and fails the fresh-receiver model
  • with the fix, both messages decompress successfully and match the original input

Files touched

  • test/extension/permessage_deflate.cpp
  • websocketpp/extensions/permessage_deflate/enabled.hpp

Target branch

Per repository guidance in readme.md, this series is based on and intended for develop.

jhugard and others added 2 commits April 3, 2026 10:16
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant