dialohq / ocaml-grpc

gRPC library for OCaml
https://dialohq.github.io/ocaml-grpc
BSD 3-Clause "New" or "Revised" License
62 stars 9 forks source link

Support "trailers-only" responses #1

Closed quernd closed 2 years ago

quernd commented 2 years ago

This is possibly related to the hang-forever bug reported by @mbacarella in dialohq/ocaml-grpc-fork#2.

Servers can respond with an empty body and headers containing the gRPC status that would normally be packaged as trailing headers at the end of the body. E.g. if you call etcd with a non-existing method, the response is just HTTP headers:

((":status" "200")("content-type" "application/grpc")("grpc-status" "12")
("grpc-message" "unknown method This_method_is_missing"))

And the Lwt client will hang. (Status code 12 is UNIMPLEMENTED)

Confusingly, this is called "Trailers-only" in the gRPC spec.

How to fix this: