-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add support delegating requests in HttpSysServer #24857
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
33 commits
Select commit
Hold shift + click to select a range
9780ab0
Add new ctors for RequestQueue and UrlGroup
shirhatti 8e4771c
Add DelegateRequest pinvokes
shirhatti 7dc027d
Add Request Transfer Feature
shirhatti e319c99
Fix accessibility of feature
shirhatti 2487752
Test cleanup
shirhatti e58410a
Update ref assembly
shirhatti 5173e8b
hack: Make HttpSysServer packable
shirhatti e3108fa
Cleanup based on PR feedback
shirhatti 280c7a3
Avoid sending headers after transfer
shirhatti be8d504
Fix ref assembly
shirhatti 4844d64
Fix rebase conflict
shirhatti 46cf781
Switch to DelegateRequestEx
shirhatti 5df4f17
Add feature detection
shirhatti 6c83b03
Delete ref folder
shirhatti 538bde6
Add server feature
shirhatti 76abb2f
s/RequestQueueWrapper/DelegationRule
shirhatti 5fdf65d
Fix UrlGroup was null issue
shirhatti d88f10f
Add light-up for ServerDelegationPropertyFeature
shirhatti 2077f51
Revert changes to sample
shirhatti e421331
Revert changes to sample take 2
shirhatti 2401f39
PR feedback
shirhatti 99d8167
s/Transfered/Transferred
shirhatti 1fc46da
DelegateAfterRequestBodyReadShouldThrow
shirhatti 589afff
Make DelegationRule disposable
shirhatti 792c15c
More license headers
shirhatti dd1f04a
Incomplete XML doc
shirhatti d257205
PR feedback
shirhatti 6d2d642
Fix broken test
shirhatti 8726db0
PR feedback
shirhatti ef4e843
Fixup test
shirhatti b12770b
s/Transfer/Delegate
shirhatti f503abb
s/transfer/delegate
shirhatti b70cde6
PR feedback
shirhatti 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // 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. | ||
|
|
||
| using System; | ||
| using Microsoft.Extensions.Logging; | ||
|
|
||
| namespace Microsoft.AspNetCore.Server.HttpSys | ||
| { | ||
| /// <summary> | ||
| /// Rule that maintains a handle to the Request Queue and UrlPrefix to | ||
| /// delegate to. | ||
| /// </summary> | ||
| public class DelegationRule : IDisposable | ||
| { | ||
| private readonly ILogger _logger; | ||
| /// <summary> | ||
| /// The name of the Http.Sys request queue | ||
| /// </summary> | ||
| public string QueueName { get; } | ||
| /// <summary> | ||
| /// The URL of the Http.Sys Url Prefix | ||
| /// </summary> | ||
| public string UrlPrefix { get; } | ||
| internal RequestQueue Queue { get; } | ||
|
|
||
| internal DelegationRule(string queueName, string urlPrefix, ILogger logger) | ||
| { | ||
| _logger = logger; | ||
| QueueName = queueName; | ||
| UrlPrefix = urlPrefix; | ||
| Queue = new RequestQueue(queueName, UrlPrefix, _logger, receiver: true); | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| Queue.UrlGroup?.Dispose(); | ||
| Queue?.Dispose(); | ||
| } | ||
| } | ||
| } |
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
20 changes: 20 additions & 0 deletions
20
src/Servers/HttpSys/src/IHttpSysRequestDelegationFeature.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,20 @@ | ||
| // 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. | ||
|
|
||
| namespace Microsoft.AspNetCore.Server.HttpSys | ||
| { | ||
| public interface IHttpSysRequestDelegationFeature | ||
| { | ||
| /// <summary> | ||
| /// Indicates if the server can delegate this request to another HttpSys request queue. | ||
| /// </summary> | ||
| bool CanDelegate { get; } | ||
|
|
||
| /// <summary> | ||
| /// Attempt to delegate the request to another Http.Sys request queue. The request body | ||
| /// must not be read nor the response started before this is invoked. Check <see cref="CanDelegate"/> | ||
| /// before invoking. | ||
| /// </summary> | ||
| void DelegateRequest(DelegationRule destination); | ||
| } | ||
| } |
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,16 @@ | ||
| // 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. | ||
|
|
||
| namespace Microsoft.AspNetCore.Server.HttpSys | ||
| { | ||
| public interface IServerDelegationFeature | ||
| { | ||
| /// <summary> | ||
| /// Create a delegation rule on request queue owned by the server. | ||
| /// </summary> | ||
| /// <returns> | ||
| /// Creates a <see cref="DelegationRule"/> that can used to delegate individual requests. | ||
| /// </returns> | ||
| DelegationRule CreateDelegationRule(string queueName, string urlPrefix); | ||
| } | ||
| } |
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
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.