-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Kestrel reloadable endpoint config #21072
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
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5f7a97a
Kestrel reloadable endpoint config
halter73 231b306
Apply suggestions from code review
halter73 409288b
Fix spacing
halter73 d30f047
Consolidate server and transport shutdown logic
halter73 e4cca8d
Apply ConnectionLimitMiddleware to HTTP/3 connections
halter73 fea46ff
Make ServerAddressFeature thread safe
halter73 e2b848a
Compare complete EndpointConfig sections
halter73 9720e0d
More review feedback.
halter73 638b9ba
Update reference source
halter73 37d2725
Cleanup
halter73 bc9356c
Add integration test
halter73 f6a7d9a
Update src/Servers/Kestrel/Core/src/KestrelServerOptions.cs
halter73 4b9f2bc
Nit
halter73 03b68a7
Make ReloadsOnConfigurationChangeByDefault more reliable
halter73 432029d
Default config reloadOnChange to false
halter73 f80f222
Don't require dev cert for integration test
halter73 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/Servers/Kestrel/Core/src/Internal/ConfigSectionClone.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
#nullable enable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal | ||
{ | ||
internal class ConfigSectionClone | ||
{ | ||
public ConfigSectionClone(IConfigurationSection configSection) | ||
{ | ||
Value = configSection.Value; | ||
|
||
// GetChildren() should return an empty IEnumerable instead of null, but we guard against it since it's a public interface. | ||
var children = configSection.GetChildren() ?? Enumerable.Empty<IConfigurationSection>(); | ||
Children = children.ToDictionary(child => child.Key, child => new ConfigSectionClone(child)); | ||
} | ||
|
||
public string Value { get; } | ||
public Dictionary<string, ConfigSectionClone> Children { get; } | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
if (!(obj is ConfigSectionClone other)) | ||
{ | ||
return false; | ||
} | ||
|
||
if (Value != other.Value || Children.Count != other.Children.Count) | ||
{ | ||
return false; | ||
} | ||
|
||
foreach (var kvp in Children) | ||
{ | ||
if (!other.Children.TryGetValue(kvp.Key, out var child)) | ||
{ | ||
return false; | ||
} | ||
|
||
if (kvp.Value != child) | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public override int GetHashCode() => HashCode.Combine(Value, Children.Count); | ||
|
||
public static bool operator ==(ConfigSectionClone lhs, ConfigSectionClone rhs) => lhs is null ? rhs is null : lhs.Equals(rhs); | ||
public static bool operator !=(ConfigSectionClone lhs, ConfigSectionClone rhs) => !(lhs == rhs); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.