aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-04-26 14:16:20 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-04-26 14:16:20 -0700
commitc5b1eef8b1e6d56a9f3c25962d815ae6579c78ee (patch)
tree20dd66c0159c5ace5dd058a1180bc70ffe6dde84 /src/core
parentc3d869ef5853c4cfad57b7d3694d5260eeb7ce75 (diff)
Change C implementation to not log an "Unexpected content-type" message
when the header includes a semicolon.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lib/channel/http_server_filter.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c
index c140c61b8f..ad3462bff4 100644
--- a/src/core/lib/channel/http_server_filter.c
+++ b/src/core/lib/channel/http_server_filter.c
@@ -92,8 +92,10 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
require */
return NULL;
} else if (md->key == GRPC_MDSTR_CONTENT_TYPE) {
- if (strncmp(grpc_mdstr_as_c_string(md->value), "application/grpc+", 17) ==
- 0) {
+ const char* value_str = grpc_mdstr_as_c_string(md->value);
+ if (strncmp(value_str, "application/grpc", 16) == 0 &&
+ (strlen(value_str) == 16 ||
+ value_str[16] == '+' || value_str[16] == ';')) {
/* Although the C implementation doesn't (currently) generate them,
any custom +-suffix is explicitly valid. */
/* TODO(klempner): We should consider preallocating common values such
@@ -102,8 +104,7 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
} else {
/* TODO(klempner): We're currently allowing this, but we shouldn't
see it without a proxy so log for now. */
- gpr_log(GPR_INFO, "Unexpected content-type %s",
- grpc_mdstr_as_c_string(md->value));
+ gpr_log(GPR_INFO, "Unexpected content-type %s", value_str);
}
return NULL;
} else if (md->key == GRPC_MDSTR_TE || md->key == GRPC_MDSTR_METHOD ||