diff options
author | 2017-08-18 17:09:31 -0700 | |
---|---|---|
committer | 2017-08-18 17:32:58 -0700 | |
commit | f42587cbc3cd5059fb33c4d04c4bbd1544f4d4a9 (patch) | |
tree | 5e698532605e491c6ddae9148ea0275ddc5f0fa3 /src/core/ext | |
parent | da4f087ebee4085ef0eef938d45db72cc4f596df (diff) |
Do not add accept-encoding field when it exists
Diffstat (limited to 'src/core/ext')
-rw-r--r-- | src/core/ext/filters/http/message_compress/message_compress_filter.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index b96503972b..a32819bfe4 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -206,10 +206,13 @@ static grpc_error *process_send_initial_metadata( if (error != GRPC_ERROR_NONE) return error; - error = grpc_metadata_batch_add_tail( - exec_ctx, initial_metadata, &calld->accept_stream_encoding_storage, - GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS( - channeld->supported_stream_compression_algorithms)); + /* Do not overwrite accept-encoding header if it already presents. */ + if (!initial_metadata->idx.named.accept_encoding) { + error = grpc_metadata_batch_add_tail( + exec_ctx, initial_metadata, &calld->accept_stream_encoding_storage, + GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS( + channeld->supported_stream_compression_algorithms)); + } return error; } |