dotnet / dotnet/aspnetcore

Make HttpProtocols configuration parsing consistent with SslProtocols

Open
#58,088 18 comments 0 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

[Edit]

**Discussion Summary**: it's really not intuitive how to specify multiple protocols if there isn't an existing enum member for the combination (e.g. `Http1AndHttp2` exists, but `Http2AndHttp3` doesn't). It turns out you can you comma-separation - `"Http2, Http3"`, but that's hard to discover and quite different from how it looks in code (which uses `|`). `SslProtocols` appears to support an actual JSON list ([amcasey] I'm not 100% sure the meaning is equivalent), but it's not clear why the two would be inconsistent. We should think about how to make them both consistent and intuitive.

The actual code change will likely be quite simple (Help Wanted?), but we probably need to think through what we actually want here.

Also, it might be time to introduce "TlsProtocols", given how deprecated SSL is.

[Original]

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Currently, there are 2 enums to limit allowed HTTP protocols in Kestrel:
https://github.com/dotnet/aspnetcore/blob/c1b76241bf4043e3e54edbb236963c503eec18e0/src/Servers/Kestrel/Core/src/HttpProtocols.cs#L30
https://github.com/dotnet/aspnetcore/blob/c1b76241bf4043e3e54edbb236963c503eec18e0/src/Servers/Kestrel/Core/src/HttpProtocols.cs#L40

For those of us already on the gRPC "train", HTTP/2 is the lowest possible version for us.
But as soon as we're going for HTTP/3, we've got to set the latter, `Http1AndHttp2AndHttp3`, which feels rather strange.

Additionally, I happen to have a scenario where a non-gRPC app & its services are supposed to explicitly exclude clients without at least HTTP/2 support - which is rather cumbersome to achieve, given how easy it would be with an added `Http2AndHttp3` value.

### Describe the solution you'd like

I'd like to have said `Http2AndHttp3` added to the `HttpProtocols` enum.

### Additional context

None I can think of right now, but I'd happily provide such on request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.