sta / sta/websocket-sharp

Chrome 46 - Problems with `Sec-WebSocket-Extensions`

Open
#187 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I don't think this is the same as #166 and so I've raised a separate issue. These issues may be in the same ballpark though.

I've had problems getting rc9 to work with Chrome 46. It appears to be related to Chrome sending permessage-deflate; client_max_window_bits as a Sec-WebSocket-Extensions header. WebSocket-Sharp responds with the extension header permessage-deflate; client_no_context_takeover; server_no_context_takeover which is all too much for Chrome; it curls up and dies with WebSocket connection to 'wss://mylocation:13000/something' failed: Invalid frame header

IE by contrast doesn't send any Sec-WebSocket-Extensions headers and so, crucially, doesn't hit this code path:

https://github.com/sta/websocket-sharp/blob/master/websocket-sharp/WebSocket.cs#L673

Basically processSecWebSocketExtensionsHeader doesn't get invoked for IE.

The immediate workaround appears to be ensuring that IgnoreExtensions is set to true so processSecWebSocketExtensionsHeader is never called.

I'd be interested if anyone has any insights as to why this might be problematic.

Interestingly it looks like initial frames come through correctly and subsequent ones fail. I enclose screenshots from my Chrome devtools to illustrate:

image

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in websocket-sharp/WebSocket.cs at the referenced lines around 673 and processSecWebSocketExtensionsHeader around 1100. Reproduce the Chrome 46 handshake and compare it with the IgnoreExtensions workaround and IE behavior. Done means identifying why the negotiated extension leads to later invalid frame headers and addressing the failing path without relying on the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.