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

Upgrade socket from TCP to TLS mid-use #222

Open
partyblob opened this issue Jun 11, 2024 · 0 comments
Open

Upgrade socket from TCP to TLS mid-use #222

partyblob opened this issue Jun 11, 2024 · 0 comments

Comments

@partyblob
Copy link

partyblob commented Jun 11, 2024

Many protocols support upgrading after initial data has been sent, for example SMTP which will upgrade after a STARTTLS command
Allow an option to upgrade an unencrypted socket to an encrypted one (and possibly vice versa).

Something like void us_socket_upgrade(us_socket_t *t) (future calls on this socket object would need to set the ssl parameter to 1). Whether a socket has been upgraded or not should be up to the user to keep track of (via the socket extension, for example)

Another possible implementation would be to add a separate handler when the TLS connection has been established, which will get fired after on_open on sockets that use tls, something like void us_socket_context_on_ssl_established(us_socket_t *t), along with a method to send raw bytes over tcp rather than to encrypt them (actually I suppose this might be possible by passing ssl=0 to us_socket_write but the way I understand it this is currently likely undefined behaviour)

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

No branches or pull requests

1 participant