Skip to content
Snippets Groups Projects
Commit 6f87164f authored by Craig Tiller's avatar Craig Tiller
Browse files

Properly handle "." in metadata

parent efda009e
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ static int conforms_to(const char *s, size_t len, const uint8_t *legal_bits) { ...@@ -50,7 +50,7 @@ static int conforms_to(const char *s, size_t len, const uint8_t *legal_bits) {
int grpc_header_key_is_legal(const char *key, size_t length) { int grpc_header_key_is_legal(const char *key, size_t length) {
static const uint8_t legal_header_bits[256 / 8] = { static const uint8_t legal_header_bits[256 / 8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xff, 0x03, 0x00, 0x00, 0x00,
0x80, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
if (length == 0) { if (length == 0) {
......
...@@ -479,8 +479,10 @@ TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) { ...@@ -479,8 +479,10 @@ TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) {
send_request.set_message("Hello"); send_request.set_message("Hello");
std::pair<grpc::string, grpc::string> meta1("key1", "val1"); std::pair<grpc::string, grpc::string> meta1("key1", "val1");
std::pair<grpc::string, grpc::string> meta2("key2", "val2"); std::pair<grpc::string, grpc::string> meta2("key2", "val2");
std::pair<grpc::string, grpc::string> meta3("g.r.d-bin", "xyz");
cli_ctx.AddMetadata(meta1.first, meta1.second); cli_ctx.AddMetadata(meta1.first, meta1.second);
cli_ctx.AddMetadata(meta2.first, meta2.second); cli_ctx.AddMetadata(meta2.first, meta2.second);
cli_ctx.AddMetadata(meta3.first, meta3.second);
std::unique_ptr<ClientAsyncResponseReader<EchoResponse>> response_reader( std::unique_ptr<ClientAsyncResponseReader<EchoResponse>> response_reader(
stub_->AsyncEcho(&cli_ctx, send_request, cq_.get())); stub_->AsyncEcho(&cli_ctx, send_request, cq_.get()));
...@@ -494,6 +496,8 @@ TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) { ...@@ -494,6 +496,8 @@ TEST_P(AsyncEnd2endTest, ClientInitialMetadataRpc) {
ToString(client_initial_metadata.find(meta1.first)->second)); ToString(client_initial_metadata.find(meta1.first)->second));
EXPECT_EQ(meta2.second, EXPECT_EQ(meta2.second,
ToString(client_initial_metadata.find(meta2.first)->second)); ToString(client_initial_metadata.find(meta2.first)->second));
EXPECT_EQ(meta3.second,
ToString(client_initial_metadata.find(meta3.first)->second));
EXPECT_GE(client_initial_metadata.size(), static_cast<size_t>(2)); EXPECT_GE(client_initial_metadata.size(), static_cast<size_t>(2));
send_response.set_message(recv_request.message()); send_response.set_message(recv_request.message());
......
...@@ -52,7 +52,7 @@ static void legal(int x) { ...@@ -52,7 +52,7 @@ static void legal(int x) {
static void dump(void) { static void dump(void) {
int i; int i;
printf("static const gpr_uint8 legal_header_bits[256/8] = "); printf("static const uint8_t legal_header_bits[256/8] = ");
for (i = 0; i < 256 / 8; i++) for (i = 0; i < 256 / 8; i++)
printf("%c 0x%02x", i ? ',' : '{', legal_bits[i]); printf("%c 0x%02x", i ? ',' : '{', legal_bits[i]);
printf(" };\n"); printf(" };\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment