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 ServerOptionsSelectionCallback to SslStream #38760

Merged
merged 10 commits into from
Jul 14, 2020
Merged

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented Jul 3, 2020

This add asynchronous callback to select session properties based on name requested by client. This allow more customization besides server certificate as well as it allows async work.

Nature place for this would be AcquireServerCredentials() with other callback. But that code is far off from the async path.
So instead I hook it ion place where we get SNI info from the client hello. That is very early before we do any real work so it seems like a good fit.

So far I added one few basic tests. I want to add more using new stranger where we generate certificates but that seems to have some issues on windows. I will fix that as part of #35844 and I will leave #31097 open as reminder to add more tests.
In the mean time, this should allow Kestrel and YARP to consume new API.

contributes to #31097
contributes to #37933

@wfurt wfurt requested review from stephentoub and a team July 3, 2020 16:57
@wfurt wfurt self-assigned this Jul 3, 2020
@ghost
Copy link

ghost commented Jul 3, 2020

Tagging subscribers to this area: @dotnet/ncl
Notify danmosemsft if you want to be subscribed.

@Dotnet-GitSync-Bot
Copy link
Collaborator

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

Copy link
Contributor

@scalablecory scalablecory left a comment

Choose a reason for hiding this comment

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

just nits, otherwise this looks good.

Comment on lines 146 to 147
internal object? UserState { get; set; }
internal ServerOptionsSelectionCallback? ServerOptionDelegate { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these ever set outside of the ctor? Looks like they can be made read-only.

@wfurt wfurt merged commit 328d0cf into dotnet:master Jul 14, 2020
@wfurt wfurt deleted the asyncSNI_31097 branch July 14, 2020 18:10
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants