Skip to content

Response is not compressed when Grpc-Accept-Encoding header contains spaces between values #1881

@Mitch528

Description

@Mitch528

What version of gRPC and what language are you using?

Grpc.*: 2.4.7
C#

What operating system (Linux, Windows,...) and version?

macOS

What runtime / compiler are you using (e.g. .NET Core SDK version dotnet --info)

.NET SDK (reflecting any global.json):
Version: 6.0.400

What did you do?

Enable gzip compression on Objective-C gRPC client

What did you expect to see?

Response to be compressed

What did you see instead?

Response was not compressed

Anything else we should know about your project / environment?

The issue seems to occur due to the Objective-C client having a space between the compression algorithms in the Grpc-Accept-Encoding header.

Example Obj-C header:

Grpc-Accept-Encoding: identity, deflate, gzip

The following middleware appears to resolve the issue:

app.Use((context, next) =>
{
    context.Request.Headers["Grpc-Accept-Encoding"] = context.Request.Headers["Grpc-Accept-Encoding"]
        .ToString().Replace(" ", string.Empty);

    return next(context);
});

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions