Skip to content

Expose SNI hostname in ITlsHandshakeFeature for Kestrel/HttpSys #48572

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

Merged
merged 5 commits into from
Jun 7, 2023
Merged

Expose SNI hostname in ITlsHandshakeFeature for Kestrel/HttpSys #48572

merged 5 commits into from
Jun 7, 2023

Conversation

karimsalem1
Copy link
Contributor

@karimsalem1 karimsalem1 commented Jun 1, 2023

Expose SNI hostname in ITlsHandshakeFeature for Kestrel/HttpSys

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Summary of the changes (Less than 80 chars)

Exposing SNI HostName in the ITlsHandshakeFeature interface.

Description

Exposing SNI HostName in the ITlsHandshakeFeature interface to allow users to retrieve the server_name used in the ClientHello of the TLS handshake. This PR applies to both Kestrel and HttpSys servers.

Issue opened and API approved here: #34525

@ghost ghost added area-runtime community-contribution Indicates that the PR has been added by a community member labels Jun 1, 2023
@ghost
Copy link

ghost commented Jun 1, 2023

Thanks for your PR, @karimsalem1. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

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

Are you planning to do IIS as well?

@karimsalem1 karimsalem1 marked this pull request as ready for review June 5, 2023 23:02
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
@karimsalem1
Copy link
Contributor Author

Are you planning to do IIS as well?

Will do in another PR.

@karimsalem1 karimsalem1 changed the title Expose SNI hostname in ITlsHandshakeFeature Expose SNI hostname in ITlsHandshakeFeature for Kestrel/HttpSys Jun 6, 2023
@Tratcher Tratcher enabled auto-merge (squash) June 6, 2023 17:23
@Tratcher
Copy link
Member

Tratcher commented Jun 6, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@Tratcher Tratcher self-assigned this Jun 6, 2023
Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

Trying to use null vs String.Empty to distinguish between different conditions is discouraged, it's not self-descriptive. Is there a requirement to know if the client didn't support SNI as compared to sending an empty value? I don't think there's a practical difference from the server side, it requires an SNI value or it doesn't.

Given this, should we update the api to be string HostName => "";? Is there any value to knowing whether it's been explicitly implemented or not? I'm okay with it as-is, but making it non-nullable could reduce unnecessary null checks.

@Tratcher
Copy link
Member

Tratcher commented Jun 6, 2023

Good call, return string.Empty from the default implementation.

@halter73
Copy link
Member

halter73 commented Jun 6, 2023

I've updated the API review issue. Hopefully we can quickly approve it again Thursday.

@Tratcher Tratcher merged commit e5c9648 into dotnet:main Jun 7, 2023
@ghost ghost added this to the 8.0-preview6 milestone Jun 7, 2023
@Tratcher Tratcher added the blog-candidate Consider mentioning this in the release blog post label Jun 7, 2023
@ghost
Copy link

ghost commented Jun 7, 2023

@karimsalem1, this change will be considered for inclusion in the blog post for the release it'll ship in. Nice work!

Please ensure that the original comment in this thread contains a clear explanation of what the change does, why it's important (what problem does it solve?), and, if relevant, include things like code samples and/or performance numbers.

This content may not be exactly what goes into the blog post, but it will help the team putting together the announcement.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions blog-candidate Consider mentioning this in the release blog post community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants