-
Notifications
You must be signed in to change notification settings - Fork 835
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
Configuration of the proxied HTTP request version. #512
Merged
ManickaP
merged 15 commits into
microsoft:master
from
ManickaP:mapichov/282_configuration
Nov 10, 2020
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
dc85381
Configuration of the proxied HTTP request version.
ManickaP 47adcdb
Debug test.
ManickaP 403d62b
Fixed tests, fixed Version parsing.
ManickaP fca0d54
Addressed some PR feedback.
ManickaP dfff014
Merge master
ManickaP 885349b
Configurable request timeout.
ManickaP 48ec715
Addressed more PR feedback.
ManickaP 0b2fe2d
Specific probing tests for request version.
ManickaP 5818b8e
Addressed feedback.
ManickaP 38a2434
Merge branch 'master' into mapichov/282_configuration
ManickaP 0e18423
Added documentation comments.
ManickaP dc10c82
Documentation.
ManickaP a4b3dd7
Reverted unintentional styling change.
ManickaP cd097ed
More rounds of feedback.
ManickaP 067beaf
Feedback.
ManickaP 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 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 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 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 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
64 changes: 64 additions & 0 deletions
64
src/ReverseProxy/Abstractions/ClusterDiscovery/Contract/ProxyHttpRequestOptions.cs
This file contains 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,64 @@ | ||
using System; | ||
using System.Net.Http; | ||
|
||
namespace Microsoft.ReverseProxy.Abstractions | ||
{ | ||
/// <summary> | ||
/// Outgoing request configuration. | ||
/// </summary> | ||
public sealed class ProxyHttpRequestOptions | ||
Tratcher marked this conversation as resolved.
Show resolved
Hide resolved
Tratcher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
/// <summary> | ||
/// Timeout for the outgoing request. | ||
/// Default is 100 seconds. | ||
/// </summary> | ||
public TimeSpan? RequestTimeout { get; set; } | ||
Tratcher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// <summary> | ||
/// HTTP version for the outgoing request. | ||
/// Default is HTTP/2. | ||
/// </summary> | ||
public Version Version { get; set; } | ||
|
||
#if NET | ||
/// <summary> | ||
/// Version policy for the outgoing request. | ||
/// Defines whether to upgrade or downgrade HTTP version if possible. | ||
/// Default is <c>RequestVersionOrLower</c>. | ||
/// </summary> | ||
public HttpVersionPolicy? VersionPolicy { get; set; } | ||
#endif | ||
|
||
internal ProxyHttpRequestOptions DeepClone() | ||
{ | ||
return new ProxyHttpRequestOptions | ||
{ | ||
RequestTimeout = RequestTimeout, | ||
Version = Version, | ||
#if NET | ||
VersionPolicy = VersionPolicy, | ||
#endif | ||
}; | ||
} | ||
|
||
internal static bool Equals(ProxyHttpRequestOptions options1, ProxyHttpRequestOptions options2) | ||
{ | ||
if (options1 == null && options2 == null) | ||
{ | ||
return true; | ||
} | ||
|
||
if (options1 == null || options2 == null) | ||
{ | ||
return false; | ||
} | ||
|
||
return options1.RequestTimeout == options2.RequestTimeout | ||
&& options1.Version == options2.Version | ||
#if NET | ||
&& options1.VersionPolicy == options2.VersionPolicy | ||
#endif | ||
; | ||
} | ||
} | ||
} |
This file contains 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 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
32 changes: 32 additions & 0 deletions
32
src/ReverseProxy/Configuration/Contract/ProxyHttpRequestData.cs
This file contains 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,32 @@ | ||
using System; | ||
using System.Net.Http; | ||
|
||
namespace Microsoft.ReverseProxy.Configuration.Contract | ||
{ | ||
/// <summary> | ||
/// Outgoing request configuration. | ||
/// </summary> | ||
public class ProxyHttpRequestData | ||
{ | ||
/// <summary> | ||
/// Timeout for the outgoing request. | ||
/// Default is 100 seconds. | ||
/// </summary> | ||
public TimeSpan? RequestTimeout { get; set; } | ||
|
||
/// <summary> | ||
/// HTTP version for the outgoing request. | ||
/// Default is HTTP/2. | ||
/// </summary> | ||
public string Version { get; set; } | ||
|
||
#if NET | ||
/// <summary> | ||
/// Version policy for the outgoing request. | ||
/// Defines whether to upgrade or downgrade HTTP version if possible. | ||
/// Default is <c>RequestVersionOrLower</c>. | ||
/// </summary> | ||
public HttpVersionPolicy? VersionPolicy { get; set; } | ||
#endif | ||
} | ||
} |
This file contains 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 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 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 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.
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.
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.