aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-09-22 17:22:19 -0700
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-09-22 17:22:19 -0700
commit1f7c015d5e12d608d869d26ffaf9e599b156ea5f (patch)
tree91a11318d51fc5e7168b53ff6361f6b7e446fc9d
parent1ecb93631c81b0fb637835700d4d58b7046b0f06 (diff)
parent4f1fe54c2d39fec5ee98833ae17eab4c69f45638 (diff)
Merge pull request #3425 from ctiller/types
Move content-type handling code across to 0.11
-rw-r--r--src/core/channel/http_client_filter.c8
-rw-r--r--src/core/channel/http_server_filter.c3
2 files changed, 9 insertions, 2 deletions
diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c
index ec832a0367..5f20f8c16d 100644
--- a/src/core/channel/http_client_filter.c
+++ b/src/core/channel/http_client_filter.c
@@ -70,7 +70,7 @@ typedef struct channel_data {
/* used to silence 'variable not used' warnings */
static void ignore_unused(void *ignored) {}
-static grpc_mdelem *client_filter(void *user_data, grpc_mdelem *md) {
+static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
grpc_call_element *elem = user_data;
channel_data *channeld = elem->channel_data;
if (md == channeld->status) {
@@ -78,6 +78,8 @@ static grpc_mdelem *client_filter(void *user_data, grpc_mdelem *md) {
} else if (md->key == channeld->status->key) {
grpc_call_element_send_cancel(elem);
return NULL;
+ } else if (md->key == channeld->content_type->key) {
+ return NULL;
}
return md;
}
@@ -92,11 +94,13 @@ static void hc_on_recv(void *user_data, int success) {
grpc_stream_op *op = &ops[i];
if (op->type != GRPC_OP_METADATA) continue;
calld->got_initial_metadata = 1;
- grpc_metadata_batch_filter(&op->data.metadata, client_filter, elem);
+ grpc_metadata_batch_filter(&op->data.metadata, client_recv_filter, elem);
}
calld->on_done_recv->cb(calld->on_done_recv->cb_arg, success);
}
+
+
static grpc_mdelem *client_strip_filter(void *user_data, grpc_mdelem *md) {
grpc_call_element *elem = user_data;
channel_data *channeld = elem->channel_data;
diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c
index 0955ae319a..2f061946a1 100644
--- a/src/core/channel/http_server_filter.c
+++ b/src/core/channel/http_server_filter.c
@@ -46,6 +46,7 @@ typedef struct call_data {
gpr_uint8 seen_te_trailers;
gpr_uint8 seen_authority;
grpc_linked_mdelem status;
+ grpc_linked_mdelem content_type;
grpc_stream_op_buffer *recv_ops;
/** Closure to call when finished with the hs_on_recv hook */
@@ -202,6 +203,8 @@ static void hs_mutate_op(grpc_call_element *elem,
calld->sent_status = 1;
grpc_metadata_batch_add_head(&op->data.metadata, &calld->status,
GRPC_MDELEM_REF(channeld->status_ok));
+ grpc_metadata_batch_add_tail(&op->data.metadata, &calld->content_type,
+ GRPC_MDELEM_REF(channeld->content_type));
break;
}
}