Skip to content

Conversation

@715d
Copy link
Contributor

@715d 715d commented Jan 30, 2026

In serveWS, when a Safari user-agent is detected, the code mutates e.acceptOptions.CompressionMode directly to disable compression. Since e.acceptOptions is shared across all requests, this mutation leaks to subsequent non-Safari connections (they also get compression disabled). There is also a data race: concurrent WebSocket upgrades read and write the same struct field without synchronization.

I replaced the shared mutation with a per-request local copy. Non-Safari requests pass e.acceptOptions as-is (read-only). Safari requests shallow-copy the struct into a local variable and set CompressionDisabled on the copy. The shared e.acceptOptions is never modified after initialization.

@715d 715d marked this pull request as ready for review January 30, 2026 03:49
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