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

Implement Acceptor API #155

Closed
jsha opened this issue Oct 17, 2021 · 0 comments · Fixed by #243
Closed

Implement Acceptor API #155

jsha opened this issue Oct 17, 2021 · 0 comments · Fixed by #243
Assignees

Comments

@jsha
Copy link
Collaborator

jsha commented Oct 17, 2021

rustls 0.20.0 introduced the Acceptor API. This allows servers to read off a ClientHello before constructing a Connection, which makes selection of server certificates easier. For more details see rustls/rustls#89.

@jsha jsha self-assigned this Nov 18, 2021
@jsha jsha closed this as completed in #243 Feb 17, 2023
jsha added a commit that referenced this issue Feb 17, 2023
Fixes #155.

Since this relies on an "into" pattern (for the Accepted -> Connection
transform), I've implemented the safer "into" pattern from #244: a
rustls_acceptor always needs to be freed, whether its "into" method was
called or not. This reduces the risk of double frees. I've introduced
the new result code `rustls_result::AlreadyUsed` to cover the case when
an accessor was called after the "into" method was called.

I've introduced another new result code `rustls_result::AcceptorNotReady`
to cover the case when `accept()` returns `Ok(None)`.

For convenience I've flattened the methods from ClientHello onto
`rustls_accepted`, so you don't need to get a ClientHello pointer out
of the `rustls_accepted`, you can call the accessors directly.

Since we now have an accessor returning a `rustls_str` (previously they
were passed in callbacks), we needed a way to make the lifetime of a
`rustls_str` longer than the function that made it, so I introduced an
`rustls_str::into_static` method.
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 a pull request may close this issue.

1 participant