diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index d8393337cd4e10852ba9eea0bf6a27418ed21603..41c33899b0e8e1a3f5f8e4eeffc5f31bcb342458 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -131,7 +131,7 @@ static grpc_mdelem *server_filter(grpc_exec_ctx *exec_ctx, void *user_data, /* TODO(klempner): Track that we've seen all the headers we should require */ return NULL; - } else if (grpc_slice_cmp(md->key, GRPC_MDSTR_CONTENT_TYPE)) { + } else if (grpc_slice_cmp(md->key, GRPC_MDSTR_CONTENT_TYPE) == 0) { if (grpc_slice_buf_start_eq(md->value, EXPECTED_CONTENT_TYPE, EXPECTED_CONTENT_TYPE_LENGTH) && (GRPC_SLICE_START_PTR(md->value)[EXPECTED_CONTENT_TYPE_LENGTH] == '+' || diff --git a/src/core/lib/transport/static_metadata.c b/src/core/lib/transport/static_metadata.c index b30b8a046bd922d0603309cdf89ed32f5e407834..7702b7cdfc3486e24d7daa250adbeccdae444d6d 100644 --- a/src/core/lib/transport/static_metadata.c +++ b/src/core/lib/transport/static_metadata.c @@ -400,7 +400,6 @@ int grpc_static_metadata_index(grpc_slice slice) { return id == 255 ? -1 : id; } -grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 6, 2, 4, 8, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -456,16 +455,331 @@ grpc_mdelem *grpc_static_mdelem_for_static_strings(int a, int b) { return elem_keys[h] == k ? &grpc_static_mdelem_table[elem_idxs[h]] : NULL; } -const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = - {11, 33, 10, 33, 12, 33, 12, 54, 13, 33, 14, 33, 15, 33, 16, 33, 17, 33, - 19, 33, 20, 33, 21, 33, 22, 33, 23, 33, 24, 33, 25, 33, 26, 33, 27, 33, - 28, 18, 28, 33, 29, 33, 30, 33, 34, 33, 35, 33, 36, 33, 37, 33, 40, 31, - 40, 32, 40, 53, 40, 58, 40, 59, 40, 60, 40, 61, 45, 31, 45, 53, 45, 58, - 50, 0, 50, 1, 50, 2, 55, 33, 62, 33, 63, 33, 64, 33, 65, 33, 66, 33, - 67, 33, 68, 33, 69, 33, 70, 33, 71, 33, 72, 33, 73, 38, 73, 75, 73, 78, - 74, 86, 74, 88, 76, 33, 77, 33, 79, 33, 80, 33, 81, 33, 82, 33, 83, 39, - 83, 56, 83, 57, 84, 33, 85, 33, 89, 3, 89, 4, 89, 5, 89, 6, 89, 7, - 89, 8, 89, 9, 90, 33, 91, 92, 93, 33, 94, 33, 95, 33, 96, 33, 97, 33}; - +grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 30, .length = 14}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 24, .length = 6}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 44, .length = 15}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 44, .length = 15}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 577, .length = 13}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 59, .length = 15}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 74, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 87, .length = 27}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 114, .length = 3}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 117, .length = 5}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 138, .length = 10}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 148, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 161, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 174, .length = 19}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 193, .length = 16}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 209, .length = 16}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 225, .length = 14}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 239, .length = 16}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 255, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 268, .length = 12}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 122, .length = 16}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 268, .length = 12}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 280, .length = 6}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 286, .length = 4}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 4}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 313, .length = 6}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 319, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 326, .length = 4}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 290, .length = 7}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 297, .length = 12}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 573, .length = 4}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 603, .length = 8}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 611, .length = 16}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 627, .length = 21}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 337, .length = 20}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 648, .length = 13}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 290, .length = 7}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 573, .length = 4}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 449, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 603, .length = 8}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 0, .length = 1}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 1, .length = 1}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 534, .length = 11}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 2, .length = 1}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 590, .length = 4}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 661, .length = 8}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 669, .length = 17}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 686, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 699, .length = 8}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 707, .length = 19}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 726, .length = 13}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 739, .length = 11}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 750, .length = 8}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 758, .length = 4}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 762, .length = 8}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 770, .length = 12}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 330, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 794, .length = 4}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 782, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 835, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 789, .length = 5}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 891, .length = 1}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 789, .length = 5}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 928, .length = 11}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 798, .length = 18}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 816, .length = 19}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 838, .length = 5}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 843, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 850, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 857, .length = 11}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 333, .length = 4}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 594, .length = 4}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 868, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 598, .length = 5}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 875, .length = 6}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 881, .length = 10}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 3, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 6, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 9, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 12, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 15, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 18, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 939, .length = 7}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 21, .length = 3}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 946, .length = 25}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 971, .length = 2}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 973, .length = 8}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 981, .length = 17}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 998, .length = 10}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 1008, .length = 4}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 1012, .length = 3}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, + {{.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 1015, .length = 16}}, + {.refcount = &g_refcnt, + .data.refcounted = {.bytes = g_raw_bytes + 309, .length = 0}}}, +}; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30, 28, 32, 27, 31}; diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index 282a3231cabedff5cdbd44563efc70d222eb9eb1..65cb37d444870fadd4578c41d4ab58526d8e57cb 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -425,8 +425,6 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; #define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[80]) grpc_mdelem *grpc_static_mdelem_for_static_strings(int a, int b); -extern const uint8_t - grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2]; extern const uint8_t grpc_static_accept_encoding_metadata[8]; #define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) \ (&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]]) diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index a43941b396ae86ce8261f380bc5bcc1ea04c7655..c9d5c247984646a3f26dd100241c56762b21a862 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -107,6 +107,9 @@ static char *read_string(input_stream *inp, bool *special) { if (special != NULL) { *special = (c == 1); } + if (c == 1) { + str[sz-1] = 0; + } return str; } diff --git a/test/core/iomgr/ev_epoll_linux_test.c b/test/core/iomgr/ev_epoll_linux_test.c index 564b05d7f4c727335dbdd53e1b01d79b53056b01..81e9fe855ec45105e030029f5d89d5a944596bc0 100644 --- a/test/core/iomgr/ev_epoll_linux_test.c +++ b/test/core/iomgr/ev_epoll_linux_test.c @@ -236,7 +236,12 @@ int main(int argc, char **argv) { "strategy. and the current strategy is: '%s'", poll_strategy); } - grpc_iomgr_shutdown(); + + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_iomgr_shutdown(&exec_ctx); + grpc_exec_ctx_finish(&exec_ctx); + } return 0; } #else /* defined(GRPC_LINUX_EPOLL) */ diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 05572ea38b81999508a2c7b80fdc8c6cf5a406a8..614b0efaa6a0e675e6bfa8df811e1ed6fe6a1e3d 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -321,8 +321,12 @@ print >>C, 'const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = str_ofs = 0 revmap = {} zero_length_idx = None +id2strofs = {} +def slice_def(i): + return '{.refcount = &g_refcnt, .data.refcounted = {.bytes = g_raw_bytes+%d, .length=%d}}' % (id2strofs[i], len(all_strs[i])) for i, elem in enumerate(all_strs): - print >>C, '{.refcount = &g_refcnt, .data.refcounted = {.bytes = g_raw_bytes+%d, .length=%d}},' % (str_ofs, len(elem)) + id2strofs[i] = str_ofs + print >>C, slice_def(i) + ',' revmap[str_ofs] = i if len(elem) == 0: zero_length_idx = i str_ofs += len(elem); @@ -353,7 +357,6 @@ for i, elem in enumerate(all_elems): print >>H, '/* "%s": "%s" */' % elem print >>H, '#define %s (&grpc_static_mdelem_table[%d])' % (mangle(elem).upper(), i) print >>H -print >>C, 'grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];' print >>C, 'uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {' print >>C, ' %s' % ','.join('%d' % static_userdata.get(elem, 0) for elem in all_elems) print >>C, '};' @@ -437,11 +440,10 @@ print >>C, ' return elem_keys[h] == k ? &grpc_static_mdelem_table[elem_idxs[h]] print >>C, '}' print >>C -print >>H, 'extern const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2];' -print >>C, 'const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2] = {' -print >>C, ','.join('%d' % str_idx(x) for x in itertools.chain.from_iterable([a,b] for a, b in all_elems)) +print >>C, 'grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {' +for a, b in all_elems: + print >>C, '{%s,%s},' % (slice_def(str_idx(a)), slice_def(str_idx(b))) print >>C, '};' -print >>C print >>H, 'extern const uint8_t grpc_static_accept_encoding_metadata[%d];' % (1 << len(COMPRESSION_ALGORITHMS)) print >>C, 'const uint8_t grpc_static_accept_encoding_metadata[%d] = {' % (1 << len(COMPRESSION_ALGORITHMS))