Skip to content
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

Add HTTP version configuration to GrpcChannelOptions #2514

Merged
merged 5 commits into from
Aug 21, 2024

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 21, 2024

Fixes #2404

The grpc client today can automatically upgrade to HTTP3. That is unexpected for most users and it can cause changes in behavior.

Also, there are situations where you want more exact control over HTTP version. Having to use a delegating handler is an awkward solution.

This PR:

  • Adds GrpcChannelOptions.HttpVersion and GrpcChannelOptions.HttpVersionPolicy.
  • Obsoletes GrpcWebHandler.HttpVersion and points users to the channel options
  • Changes default version policy behavior to RequestVersionExact. Client will use HTTP/2 unless configured otherwise.

@JamesNK
Copy link
Member Author

JamesNK commented Aug 21, 2024

cc @jskeet

@jskeet
Copy link

jskeet commented Aug 21, 2024

Wonderful, thank you so much!

/// 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; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume something blows up downstream if someone sets 2.5 or 7.0, but what happens if they select 1.1?

Copy link
Contributor

Choose a reason for hiding this comment

The 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?).

Copy link
Member Author

@JamesNK JamesNK Aug 21, 2024

Choose a reason for hiding this comment

The 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.

src/Grpc.Net.Client.Web/GrpcWebHandler.cs Show resolved Hide resolved
Co-authored-by: Andrew Casey <amcasey@users.noreply.github.com>
@JamesNK JamesNK merged commit e9cc7e1 into grpc:master Aug 21, 2024
5 checks passed
@JamesNK JamesNK deleted the jamesnk/add-http-version-policy branch August 21, 2024 23:53
oguzhand95 referenced this pull request in cerbos/cerbos-sdk-net Sep 23, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[Google.Protobuf](https://redirect.github.com/protocolbuffers/protobuf)
| `3.28.1` -> `3.28.2` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/Google.Protobuf/3.28.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/Google.Protobuf/3.28.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/Google.Protobuf/3.28.1/3.28.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Google.Protobuf/3.28.1/3.28.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [Grpc.Net.Client](https://redirect.github.com/grpc/grpc-dotnet) |
`2.65.0` -> `2.66.0` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/Grpc.Net.Client/2.66.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/Grpc.Net.Client/2.66.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/Grpc.Net.Client/2.65.0/2.66.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Grpc.Net.Client/2.65.0/2.66.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>grpc/grpc-dotnet (Grpc.Net.Client)</summary>

###
[`v2.66.0`](https://redirect.github.com/grpc/grpc-dotnet/releases/tag/v2.66.0)

#### What's Changed

- Bump version on master to 2.66.0-dev by
[@&#8203;stanley-cheung](https://redirect.github.com/stanley-cheung) in
[https://github.com/grpc/grpc-dotnet/pull/2491](https://redirect.github.com/grpc/grpc-dotnet/pull/2491)
- Fix failure to create GrpcChannel under Wine compatibility layer
(including Steam Proton and Apple Game Porting Toolkit) by
[@&#8203;mayuki](https://redirect.github.com/mayuki) in
[https://github.com/grpc/grpc-dotnet/pull/2496](https://redirect.github.com/grpc/grpc-dotnet/pull/2496)
- Update .NET 9 SDK and resolve warnings by
[@&#8203;sebastienros](https://redirect.github.com/sebastienros) in
[https://github.com/grpc/grpc-dotnet/pull/2502](https://redirect.github.com/grpc/grpc-dotnet/pull/2502)
- Bump braces from 3.0.2 to 3.0.3 in
/testassets/InteropTestsGrpcWebWebsite/Tests by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2504](https://redirect.github.com/grpc/grpc-dotnet/pull/2504)
- Bump axios from 1.6.2 to 1.7.4 in
/testassets/InteropTestsGrpcWebWebsite/Tests by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2505](https://redirect.github.com/grpc/grpc-dotnet/pull/2505)
- Update puppeteer by
[@&#8203;JamesNK](https://redirect.github.com/JamesNK) in
[https://github.com/grpc/grpc-dotnet/pull/2507](https://redirect.github.com/grpc/grpc-dotnet/pull/2507)
- Remove internal_ci flag from interop test script by
[@&#8203;JamesNK](https://redirect.github.com/JamesNK) in
[https://github.com/grpc/grpc-dotnet/pull/2509](https://redirect.github.com/grpc/grpc-dotnet/pull/2509)
- Fix Google auth interop test by
[@&#8203;JamesNK](https://redirect.github.com/JamesNK) in
[https://github.com/grpc/grpc-dotnet/pull/2512](https://redirect.github.com/grpc/grpc-dotnet/pull/2512)
- \[testing] improve sanity check in jwt_token_creds interop test by
[@&#8203;apolcyn](https://redirect.github.com/apolcyn) in
[https://github.com/grpc/grpc-dotnet/pull/2513](https://redirect.github.com/grpc/grpc-dotnet/pull/2513)
- Add HTTP version configuration to GrpcChannelOptions by
[@&#8203;JamesNK](https://redirect.github.com/JamesNK) in
[https://github.com/grpc/grpc-dotnet/pull/2514](https://redirect.github.com/grpc/grpc-dotnet/pull/2514)
- Bump grpc.tools version to 2.66 by
[@&#8203;apolcyn](https://redirect.github.com/apolcyn) in
[https://github.com/grpc/grpc-dotnet/pull/2523](https://redirect.github.com/grpc/grpc-dotnet/pull/2523)
- Bump webpack from 5.76.0 to 5.94.0 in /examples/Browser/Server/wwwroot
by [@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2522](https://redirect.github.com/grpc/grpc-dotnet/pull/2522)
- Bump elliptic from 6.5.4 to 6.5.7 in /examples/Spar/Server/ClientApp
by [@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2525](https://redirect.github.com/grpc/grpc-dotnet/pull/2525)
- Bump micromatch from 4.0.7 to 4.0.8 in
/testassets/InteropTestsGrpcWebWebsite/Tests by
[@&#8203;dependabot](https://redirect.github.com/dependabot) in
[https://github.com/grpc/grpc-dotnet/pull/2524](https://redirect.github.com/grpc/grpc-dotnet/pull/2524)
- Bump v2.66.x branch to 2.66.0.pre1 by
[@&#8203;apolcyn](https://redirect.github.com/apolcyn) in
[https://github.com/grpc/grpc-dotnet/pull/2526](https://redirect.github.com/grpc/grpc-dotnet/pull/2526)
- Bump v2.66.x to v2.66.0 by
[@&#8203;apolcyn](https://redirect.github.com/apolcyn) in
[https://github.com/grpc/grpc-dotnet/pull/2539](https://redirect.github.com/grpc/grpc-dotnet/pull/2539)

**Full Changelog**:
grpc/grpc-dotnet@v2.65.0...v2.66.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/cerbos/cerbos-sdk-net).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiYXJlYS9jaSIsImJvdHMiLCJraW5kL2Nob3JlIl19-->

---------

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Oğuzhan Durgun <oguzhandurgun95@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only 100 streaming calls get responses under very specific conditions
3 participants