grpc / grpc-dart

The Dart language implementation of gRPC.
https://pub.dev/packages/grpc
Apache License 2.0
861 stars 271 forks source link

GRPC server seems to always compress messages even if client does not support it. #669

Open RubenGarcia opened 1 year ago

RubenGarcia commented 1 year ago
GRPC server seems to always compress messages even if client does not support it. See https://github.com/Cysharp/YetAnotherHttpHandler/issues/19 where client is complaining with the line Request sent 'identity' grpc-encoding value with compressed message. #19 grpc: dependency: "direct main" description: name: grpc sha256: "220ffb2218288f4e7dea487242e08b9c6277596d9b6f3f10ba50be96771a032d" url: "https://pub.dev" source: hosted version: "3.2.3" ## Repro steps 1. Generate a dart grpc server 2. Use Unity and YetAnotherHttpHandler to connect to it Expected result: The client receives the correct answer Actual result: Request sent 'identity' grpc-encoding value with compressed message. #19
RubenGarcia commented 1 year ago

Removing compression using

 codecRegistry: CodecRegistry(codecs: const [/*GzipCodec(), */IdentityCodec()]),

does not make a difference.

RubenGarcia commented 8 months ago

Version: "3.2.4" is also affected.

RubenGarcia commented 8 months ago

Tested on android and on osx, both platforms have the issue.

RubenGarcia commented 8 months ago

After some debugging, these are my results:

This means the grpc message is ill-constructed. The correct condition should be

header.setUint8(0, (codec == null || codec.encodingName =="identity") ? 0 : 1);
RubenGarcia commented 8 months ago

Merge request fixing the issue. https://github.com/grpc/grpc-dart/pull/693