grpc-dotnet icon indicating copy to clipboard operation
grpc-dotnet copied to clipboard

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

Open pcwiese opened this issue 2 years ago • 2 comments

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.

pcwiese avatar Apr 15 '22 19:04 pcwiese

possibly related to: https://github.com/dotnet/runtime/issues/63808

pcwiese avatar Apr 18 '22 20:04 pcwiese

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.

JamesNK avatar Apr 18 '22 22:04 JamesNK