Skip to content

feat: add max_header_len & validate_handshake options #94

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tjasko
Copy link

@tjasko tjasko commented Mar 15, 2025

Introducing new functionality to add two new options to client:new(). Changes have been implemented in a way to retain backward compatibility.

  • Added max_header_len option to limit the maximum allowed header size during the WebSocket upgrade process.
  • Added validate_handshake option to enforce that the WebSocket handshake response must return HTTP 101.
  • Improved HTTP response parsing by checking the status line and extracting response headers properly.
  • Added new test cases

Not all existing tests are passing, but that's unrelated to this improvement. I had to re-generate a new certificate to get Nginx happy, this likely should be fixed in another pull request & add the below to the Makefile:

$ openssl req -new -key test.key -out test.csr -subj "/C=US/ST=California/L=San Francisco/O=OpenResty/OU=OpenResty/CN=test.com/[email protected]"
$ openssl x509 -req -days 365 -in test.csr -signkey test.key -out test.crt

Thanks for considering this change!

@tjasko tjasko force-pushed the feat/ws-upgrade-validation branch from 884133b to 9710364 Compare March 15, 2025 02:42
- Added `max_header_len` option to limit the maximum allowed header
  size during the WebSocket upgrade process.
- Added `validate_handshake` option to enforce that the WebSocket
  handshake response must return HTTP 101.
- Improved HTTP response parsing by checking the status line and
  extracting response headers properly.
- Added new test cases
@tjasko tjasko force-pushed the feat/ws-upgrade-validation branch from 9710364 to 2db11ae Compare March 15, 2025 03:10
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