Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make compression negotiation more lenient #258

Merged
merged 4 commits into from Oct 13, 2023
Merged

Conversation

abursavich
Copy link
Contributor

@abursavich abursavich commented Sep 9, 2020

I ran into a server this morning that was being extra-super-duper explicit and specifying server_max_window_bits=15, so I started digging into the RFC and the negotiation code... These are the changes I would like to make:

  1. Client allows server to specify server_max_window_bits: The server may use a smaller sliding window for compression without affecting the client's decompression.
  2. Server allows client to specify server_max_window_bits=15: Although the server can't support a smaller sliding window at the moment, it doesn't hurt to accept the specification of 15 bits from a client.
  3. Server declines unacceptable compression offers without rejecting the request and selects the first acceptable offer: According to the RFC, the client may send multiple offers in its preferential order and the server may accept its preferred offer or decline all of them. Declining a compression offer doesn't mean the connection must be terminated.
  4. Removes dead x-webkit-deflate-frame code.

@abursavich
Copy link
Contributor Author

abursavich commented Sep 9, 2020

The RFCs allow for some strange formatting of the extensions. For instance, the parameter values may be quoted (e.g. server_max_window_bits="15"). I went ahead and implemented full parsing in a different branch. It's not necessary to fix the specific issue I ran into, but it's here if you're interested: abursavich/websocket@compression...abursavich:headers

@abursavich abursavich changed the title Make compression negotiation more more lenient Make compression negotiation more lenient Sep 9, 2020
@nhooyr
Copy link
Owner

nhooyr commented Sep 11, 2020

Thanks for contributing @abursavich! <3

Unfortunately I'm going to be a busy this week until the weekend. I'll try and review these changes then.

Have a great rest of your week!

Copy link
Owner

@nhooyr nhooyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful, sorry for the delay.

@nhooyr nhooyr merged commit 97d7f90 into nhooyr:dev Oct 13, 2023
1 of 3 checks passed
@nhooyr
Copy link
Owner

nhooyr commented Oct 13, 2023

Thanks @abursavich!

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.

None yet

2 participants