client must not attempt decode responses with wrong content type
Author: stepanchegCreated Aug 1, 2025Updated Aug 27, 2026
LabelsC-bug
Bug Report
When non-gRPC error is returned, for example 502 bad gateway by a proxy server, tonic client returns an error like
status: Internal, message: "protocol error: received message with invalid compression flag: 60 (valid flags are 0 and 1) while receiving response with status: 502 Bad Gateway", details: [], metadata: MetadataMap { headers: {"date": "Fri, 01 Aug 2025 02:23:45 GMT", "content-type": "text/html", "content-length": "150", "strict-transport-security": "max-age=31536000; includeSubDomains"} }Content-type is not application/grpc, so attempt to read first byte as either 0 or 1 for compression is incorrect.
Version
0.13
Error comes from here:
Source: grpc/grpc-rust