-
Notifications
You must be signed in to change notification settings - Fork 815
Add HTTP version configuration to GrpcChannelOptions #2514
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #region Copyright notice and license | ||
| #region Copyright notice and license | ||
|
|
||
| // Copyright 2019 The gRPC Authors | ||
| // | ||
|
|
@@ -287,6 +287,35 @@ public TimeSpan InitialReconnectBackoff | |
| /// </summary> | ||
| public IServiceProvider? ServiceProvider { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the HTTP version to use when making gRPC calls. | ||
| /// <para> | ||
| /// When a <see cref="Version"/> is specified the value will be set on <see cref="HttpRequestMessage.Version"/> | ||
| /// as gRPC calls are made. Changing this property allows the HTTP version of gRPC calls to | ||
| /// be overridden. | ||
| /// </para> | ||
| /// <para> | ||
| /// A <c>null</c> value doesn't override the HTTP version of gRPC calls. Defaults to <c>2.0</c>. | ||
| /// </para> | ||
| /// </summary> | ||
| public Version? HttpVersion { get; set; } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume something blows up downstream if someone sets There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the tests, it seems like this is handled somewhere (or might even be allowable?). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1.1 will successfully create a connection if the server supports 1.1 and you're using gRPC-Web. If you select a non-standard version then I'm guessing SocketsHttpHandler will error and tell you you're using a bad version. |
||
|
|
||
| #if NET5_0_OR_GREATER | ||
| /// <summary> | ||
| /// Gets or sets the HTTP policy to use when making gRPC calls. | ||
| /// <para> | ||
| /// When a <see cref="HttpVersionPolicy"/> is specified the value will be set on <see cref="HttpRequestMessage.VersionPolicy"/> | ||
| /// as gRPC calls are made. The policy determines how <see cref="Version"/> is interpreted when | ||
| /// the final HTTP version is negotiated with the server. Changing this property allows the HTTP | ||
| /// version of gRPC calls to be overridden. | ||
| /// </para> | ||
| /// <para> | ||
| /// A <c>null</c> value doesn't override the HTTP policy of gRPC calls. Defaults to <see cref="HttpVersionPolicy.RequestVersionExact"/>. | ||
| /// </para> | ||
| /// </summary> | ||
| public HttpVersionPolicy? HttpVersionPolicy { get; set; } | ||
| #endif | ||
|
|
||
| internal T ResolveService<T>(T defaultValue) | ||
| { | ||
| return (T?)ServiceProvider?.GetService(typeof(T)) ?? defaultValue; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.