From 971efedc2078cb1efd8111d12432813084bc628d Mon Sep 17 00:00:00 2001 From: dfawley Date: Fri, 28 Jul 2017 11:04:27 -0700 Subject: [PATCH] Revert "Make all "grpc-" metadata field names reserved (#1391)" (#1400) This reverts commit 3ddcdc268d88595eb2f3721f7dc87970a6c3ab6e. --- transport/http_util.go | 15 ++++++++++----- transport/transport_test.go | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/transport/http_util.go b/transport/http_util.go index c2bb0e53..685c6fbf 100644 --- a/transport/http_util.go +++ b/transport/http_util.go @@ -121,14 +121,19 @@ func isReservedHeader(hdr string) bool { if hdr != "" && hdr[0] == ':' { return true } - if strings.HasPrefix(hdr, "grpc-") { - return true - } switch hdr { - case "content-type", "te": + case "content-type", + "grpc-message-type", + "grpc-encoding", + "grpc-message", + "grpc-status", + "grpc-timeout", + "grpc-status-details-bin", + "te": return true + default: + return false } - return false } // isWhitelistedPseudoHeader checks whether hdr belongs to HTTP2 pseudoheaders diff --git a/transport/transport_test.go b/transport/transport_test.go index 97e63344..86104788 100644 --- a/transport/transport_test.go +++ b/transport/transport_test.go @@ -1577,7 +1577,7 @@ func TestIsReservedHeader(t *testing.T) { {"grpc-encoding", true}, {"grpc-message", true}, {"grpc-status", true}, - {"grpc-anything-else99999", true}, + {"grpc-timeout", true}, {"te", true}, } for _, tt := range tests {