aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-09-17 16:46:58 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-09-17 16:46:58 -0700
commit784db97ad2991330b8a7d8e1fe53bcdd06203cf3 (patch)
tree059e50adae846e0ddf997828cb19898ef6cf69fb /src
parentad96e1d37a769fd5d16524b0596cffdae471e552 (diff)
Swallow content-type at the client. Fixes #3368
Diffstat (limited to 'src')
-rw-r--r--src/core/surface/call.c2
-rw-r--r--src/core/surface/channel.c8
-rw-r--r--src/core/surface/channel.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index 4168c2ef0c..1636998f59 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -1485,6 +1485,8 @@ static void recv_metadata(grpc_call *call, grpc_metadata_batch *md) {
} else if (key == grpc_channel_get_encodings_accepted_by_peer_string(
call->channel)) {
set_encodings_accepted_by_peer(call, md->value->slice);
+ } else if (key == grpc_channel_get_content_type_string(call->channel)) {
+ continue; /* swallow "content-type" header */
} else {
dest = &call->buffered_metadata[is_trailing];
if (dest->count == dest->capacity) {
diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c
index a89523b3ab..cc9d44f45d 100644
--- a/src/core/surface/channel.c
+++ b/src/core/surface/channel.c
@@ -69,6 +69,7 @@ struct grpc_channel {
grpc_mdstr *grpc_compression_algorithm_string;
grpc_mdstr *grpc_encodings_accepted_by_peer_string;
grpc_mdstr *grpc_message_string;
+ grpc_mdstr *content_type_string;
grpc_mdstr *path_string;
grpc_mdstr *authority_string;
grpc_mdelem *default_authority;
@@ -111,6 +112,8 @@ grpc_channel *grpc_channel_create_from_filters(
grpc_mdstr_from_string(mdctx, "grpc-accept-encoding", 0);
channel->grpc_message_string =
grpc_mdstr_from_string(mdctx, "grpc-message", 0);
+ channel->content_type_string =
+ grpc_mdstr_from_string(mdctx, "content-type", 0);
for (i = 0; i < NUM_CACHED_STATUS_ELEMS; i++) {
char buf[GPR_LTOA_MIN_BUFSIZE];
gpr_ltoa((long)i, buf);
@@ -281,6 +284,7 @@ static void destroy_channel(void *p, int ok) {
GRPC_MDSTR_UNREF(channel->grpc_compression_algorithm_string);
GRPC_MDSTR_UNREF(channel->grpc_encodings_accepted_by_peer_string);
GRPC_MDSTR_UNREF(channel->grpc_message_string);
+ GRPC_MDSTR_UNREF(channel->content_type_string);
GRPC_MDSTR_UNREF(channel->path_string);
GRPC_MDSTR_UNREF(channel->authority_string);
while (channel->registered_calls) {
@@ -364,6 +368,10 @@ grpc_mdstr *grpc_channel_get_message_string(grpc_channel *channel) {
return channel->grpc_message_string;
}
+grpc_mdstr *grpc_channel_get_content_type_string(grpc_channel *channel) {
+ return channel->content_type_string;
+}
+
gpr_uint32 grpc_channel_get_max_message_length(grpc_channel *channel) {
return channel->max_message_length;
}
diff --git a/src/core/surface/channel.h b/src/core/surface/channel.h
index f271616f60..05fbc8d75c 100644
--- a/src/core/surface/channel.h
+++ b/src/core/surface/channel.h
@@ -59,6 +59,7 @@ grpc_mdstr *grpc_channel_get_compression_algorithm_string(
grpc_mdstr *grpc_channel_get_encodings_accepted_by_peer_string(
grpc_channel *channel);
grpc_mdstr *grpc_channel_get_message_string(grpc_channel *channel);
+grpc_mdstr *grpc_channel_get_content_type_string(grpc_channel *channel);
gpr_uint32 grpc_channel_get_max_message_length(grpc_channel *channel);
#ifdef GRPC_CHANNEL_REF_COUNT_DEBUG