well-typed / grapesy

Native Haskell gRPC client and server based on `http2`
Other
32 stars 4 forks source link

Set `Trailers` HTTP header #59

Closed edsko closed 3 months ago

edsko commented 5 months ago

See https://www.rfc-editor.org/rfc/rfc9110#name-processing-trailer-fields:

The "Trailer" header field can be sent to indicate fields likely to be sent in the trailer section

(my emphasis). However, RFC 7230 is not so lenient (https://datatracker.ietf.org/doc/html/rfc7230#section-4.4):

When a message includes a message body encoded with the chunked transfer coding and the sender desires to send metadata in the form of trailer fields at the end of the message, the sender SHOULD generate a Trailer header field before the message body to indicate which fields will be present in the trailers.

(emphasis in original).

Related ticket in the gRPC repo: https://github.com/grpc/grpc/issues/29540 .

Implementing this is not entirely trivial because trailers may include additional custom fields; so if we implement this, we'd have to require users to declare custom metadata in trailers up-front also.

edsko commented 3 months ago

Increasing priority of this, since some proxies are dropping the trailers.