Closed davidpasztor closed 4 years ago
CC @lukasa
swift-nio-http2 doesn't automatically lowercase the headers. This is deliberate: we wanted to avoid pushing the cost of lowercasing the headers onto every user of NIOHTTP2 even when their applications are already HTTP/2 aware and generating lowercase headers.
This seems like something gRPC should be willing to offer for user-supplied headers. It shouldn't be hard to add, the surface area is not large.
if you use the 2to1 server codec, you can ask NIO to normalise the headers for you: https://apple.github.io/swift-nio-http2/docs/current/NIOHTTP2/Classes/HTTP2ToHTTP1ServerCodec.html#/s:8NIOHTTP223HTTP2ToHTTP1ServerCodecC8streamID20normalizeHTTPHeadersAcA0b6StreamH0V_Sbtcfc
This was fixed in #730
Question Checklist
Question Subject
Call headers should be lowercased by the framework.
Question Description
On the nio branch, setting
customMetadata
onCallOptions
doesn't lowercase the headers when we set them usingcustomMetadata.add(name: "myHeader", value: "VALUE")
even though the HTTP2 standard specifies that all HTTP2 headers must be lowercase (and gRPC uses HTTP2).This can easily lead to issues when a consumer of grpc-swift sends headers in their uppercased form, since HTTP1 headers were case-insensitive, but HTTP2 headers aren't. In my opinion, it would be a good if grpc-swift handled this internally and hence wouldn't require consumers of the library to know about the inner workings of HTTP2 headers. Is this a known issue/viable change request?