Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the "grpc-encoding" header to the response (#20)
* Add the "grpc-encoding" header to the response Once the per-message compression encoding has been negotiated (by inspecting the `grpc-accept-encoding` request header), the server should tell the client the chosen encoding (either `identity` or `gzip`) by setting the `grpc-encoding` response header. The meaning of the header is: if any message in the response has its compression flag set, then that message has been compressed using this encoding. Some clients can live with the header being missing. If they encounter a message with its compression flag set, they just assume the encoding is GZip. But other clients, notably the official Java gRPC library, are stricter and require the header to be present. Aside: compression can be done at the stream level rather than the individual message level. In that case, the `content-encoding` header must be set, and the `grpc-encoding` header must *not* be set. None of this is really documented anywhere. I worked it out using Wireshark and reading the [grpc-java source](https://github.com/grpc/grpc-java/blob/8d4240f4800f20de0e5f0b7c213577b3c0324f93/core/src/main/java/io/grpc/internal/AbstractClientStream.java#L313-L356).
- Loading branch information