-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Defer search for dev cert until build bind time #48056
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
Conversation
...so that it can occur after IConfiguration is read. (In particular, so that it occurs during AddressBinder.BindAsync which happens strictly after KestrelConfigurationLoader.Load.) This is important in Docker scenarios since the Docker tools use IConfiguration to tell us where the dev cert directory is mounted.# with '#' will be ignored, and an empty message aborts the commit. Was dotnet#46296 Fixes dotnet#45801
var middleware = new HttpsConnectionMiddleware(next, httpsOptions, loggerFactory, metrics); | ||
// Evaluate the HttpsConnectionAdapterOptions, now that the configuration, if any, has been loaded | ||
var httpsOptions = lazyHttpsOptions.Value; | ||
var loggerFactory = listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService<ILoggerFactory>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will these service lookups here have a performance implication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be moved outside of the lambda so it's not happening per connection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. They were outside the lambda before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my own edification, this is a squeeze-out-every-drop type optimization, right? We're saving a lookup in a (small) dictionary and a null check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a no-need-to-do-duplicate-work cleanup. We don't expect it to have a huge per impact, but there's no reason to do that extra work here, it's no cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Would it be worthwhile to make the variables Lazy so the lookups aren't wasted in HTTP/3-only scenarios?
Will try eagerly loading configuration instead. |
So that configuration-based certs will be considered, if necessary. Largely salvaged from dotnet#48056 Builds on dotnet#48137 Fixes dotnet#45801
Defer search for dev cert until build bind time
Description
...so that it can occur after IConfiguration is read. (In particular, so that it occurs during AddressBinder.BindAsync which happens strictly after KestrelConfigurationLoader.Load.) This is important in Docker scenarios since the Docker tools use IConfiguration to tell us where the dev cert directory is mounted.# with '#' will be ignored, and an empty message aborts the commit.
Was #46296
Fixes #45801