grpc-dotnet
grpc-dotnet copied to clipboard
Spec clarification about multi-value custom metadata -> HTTP/2 headers
I have 2 questions:
Given the following set of custom metadata added
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
and produces a single header
foo: bar1,bar2
Per the spec gRPC over HTTP/2 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.
possibly related to: https://github.com/dotnet/runtime/issues/63808
Yes.
This isn't something that can be fixed in grpc-dotnet. I'm going to leave open for now while discussion happens with client networking team. Might close in the future in preference of their issue.