grpc / grpc/grpc-dotnet

Spec clarification about multi-value custom metadata -> HTTP/2 headers

Open
#1,691 2 comments 0 reactions 0 assignees View on GitHub
Conversation question
Dominant language
C#
Stars
4.5k
Forks
836
Avg merge
6d 3h
Merged PRs (30d)
7

Description

I have 2 questions:

Given the following set of custom metadata added

```csharp
var metadata = new Metadata();
metadata.Add(new Metadata.Entry("foo", "bar1"));
metadata.Add(new Metadata.Entry("foo", "bar2"));
```

I see that under the covers, headers are combined into a single header with multiple values using this class
[HttpRequestHeaders](https://docs.microsoft.com/en-us/dotnet/api/system.net.http.headers.httprequestheaders?view=net-6.0)

and produces a single header
```
foo: bar1,bar2
```

Per the spec [gRPC over HTTP/2](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requests) it seems like this is a perfectly reasonable thing to do, however this behavior differs from what a Grpc.Core or Grpc-Go client sends. Those send multiple "foo" HTTP/2 headers (verified with a network capture).

Is either method of sending a multi-value header allowed?

If that is true, my other question is if a gRPC server receives HTTP/2 headers in either form are they semantically the same? e.g. Should a multi-value header show up as multiple metadata items or a single one with a comma-separate value, or either one, all of which are semantically equivalent. If they are equivalent it means that its always the metadata consumer's responsibility to attempt to comma-unseparate anything that could be a multi-value header.

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.