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

Add new_server_side_from_acceptor to allow init from a pre-existing Acceptor #33

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

mmastrac
Copy link
Contributor

In certain cases, a TLS server may need to pre-process the incoming bytes (eg: it may want to peek to see if this is raw HTTP, or HTTP over SSL) before deciding to hand it off to a TlsStream. Because TlsStream uses raw TcpSocket, there's no way to re-inject any sniffed bytes that were read() rather than peek()'d from the socket.

This adds a new new_server_side_from_acceptor where an initial Acceptor can be passed in. It may contain either the full handshake or just a few prefix bytes that were sniffed from the socket earlier.

We test this by creating a new TLS pair where the socket sniffs the first 8 bytes of the client handshake before firing up its TlsStream.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM!

@bartlomieju bartlomieju merged commit ee5798c into denoland:main Jan 27, 2025
6 checks passed
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.

2 participants