diff options
author | Yang Gao <yangg@google.com> | 2016-12-27 16:05:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-27 16:05:35 -0800 |
commit | ddebfa65f2bdff332902adf73606bc050014b498 (patch) | |
tree | cdb3a49702c806a613c977f333f87ef8713e1a91 /test | |
parent | 578378256c306b0ef777816e83bbf1af0a04fdea (diff) | |
parent | 92fa9608f23791728dc68ff90da1be560511cc7c (diff) |
Merge pull request #9187 from yang-g/validate_reserved_metadata
Check and fail if user provides a metadata key starting with :
Diffstat (limited to 'test')
-rw-r--r-- | test/core/end2end/invalid_call_argument_test.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 765b6ad1be..d974d2c8ff 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -573,6 +573,29 @@ static void test_recv_close_on_server_twice() { cleanup_test(); } +static void test_invalid_initial_metadata_reserved_key() { + gpr_log(GPR_INFO, "test_invalid_initial_metadata_reserved_key"); + + grpc_metadata metadata; + metadata.key = ":start_with_colon"; + metadata.value = "value"; + metadata.value_length = 6; + + grpc_op *op; + prepare_test(1); + op = g_state.ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 1; + op->data.send_initial_metadata.metadata = &metadata; + op->flags = 0; + op->reserved = NULL; + op++; + GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == + grpc_call_start_batch(g_state.call, g_state.ops, + (size_t)(op - g_state.ops), tag(1), NULL)); + cleanup_test(); +} + int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); @@ -595,6 +618,7 @@ int main(int argc, char **argv) { test_send_server_status_twice(); test_recv_close_on_server_with_invalid_flags(); test_recv_close_on_server_twice(); + test_invalid_initial_metadata_reserved_key(); grpc_shutdown(); return 0; |