diff options
-rw-r--r-- | src/core/channel/http_server_filter.c | 1 | ||||
-rw-r--r-- | test/core/bad_client/tests/simple_request.c | 20 | ||||
-rw-r--r-- | test/core/bad_client/tests/simple_request_unusual.headers | 13 | ||||
-rw-r--r-- | test/cpp/end2end/generic_end2end_test.cc | 4 |
4 files changed, 36 insertions, 2 deletions
diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index 4f43a35ba1..bc3a56cbf0 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -124,7 +124,6 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) { omitted */ grpc_mdelem *authority = grpc_mdelem_from_metadata_strings( GRPC_MDSTR_AUTHORITY, GRPC_MDSTR_REF(md->value)); - GRPC_MDELEM_UNREF(md); calld->seen_authority = 1; return authority; } else { diff --git a/test/core/bad_client/tests/simple_request.c b/test/core/bad_client/tests/simple_request.c index b6c3b65ac3..5cddafc0b5 100644 --- a/test/core/bad_client/tests/simple_request.c +++ b/test/core/bad_client/tests/simple_request.c @@ -51,10 +51,27 @@ "\x10\x0c" \ "content-type\x10" \ "application/grpc" \ - "\x10\x14grpc-accept-encoding\x15identity,deflate,gzip" \ + "\x10\x14grpc-accept-encoding\x15""deflate,identity,gzip" \ "\x10\x02te\x08trailers" \ "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)" +#define PFX_STR_UNUSUAL \ + "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \ + "\x00\x00\x00\x04\x00\x00\x00\x00\x00" /* settings frame */ \ + "\x00\x00\xf4\x01\x04\x00\x00\x00\x01" /* headers: generated from \ + simple_request_unusual.headers \ + in this directory */ \ + "\x10\x05:path\x08/foo/bar" \ + "\x10\x07:scheme\x04http" \ + "\x10\x07:method\x04POST" \ + "\x10\x04host\x09localhost" \ + "\x10\x0c""content-type\x1e""application/grpc+this-is-valid" \ + "\x10\x14grpc-accept-encoding\x15identity,deflate,gzip" \ + "\x10\x02te\x08trailers" \ + "\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)" \ + "\x10\x0cgrpc-timeout\x03""10S" \ + "\x10\x0cgrpc-timeout\x02""5S" + static void *tag(gpr_intptr t) { return (void *)t; } static void verifier(grpc_server *server, grpc_completion_queue *cq) { @@ -87,6 +104,7 @@ int main(int argc, char **argv) { /* basic request: check that things are working */ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR, 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR_UNUSUAL, 0); /* push an illegal data frame */ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR diff --git a/test/core/bad_client/tests/simple_request_unusual.headers b/test/core/bad_client/tests/simple_request_unusual.headers new file mode 100644 index 0000000000..f36e1dfc9f --- /dev/null +++ b/test/core/bad_client/tests/simple_request_unusual.headers @@ -0,0 +1,13 @@ +# headers used in simple_request.c +# use tools/codegen/core/gen_header_frame.py to generate the binary strings +# contained in the source code +:path: /foo/bar +:scheme: http +:method: POST +host: localhost +content-type: application/grpc+this-is-valid +grpc-accept-encoding: deflate,identity,gzip +te: trailers +user-agent: bad-client grpc-c/0.12.0.0 (linux) +grpc-timeout: 10S +grpc-timeout: 5S diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 082119d6d5..6ecf7eb2fe 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -102,6 +102,10 @@ class GenericEnd2endTest : public ::testing::Test { builder.AddListeningPort(server_address_.str(), InsecureServerCredentials()); builder.RegisterAsyncGenericService(&generic_service_); + // Include a second call to RegisterAsyncGenericService to make sure that + // we get an error in the log, since it is not allowed to have 2 async + // generic services + builder.RegisterAsyncGenericService(&generic_service_); srv_cq_ = builder.AddCompletionQueue(); server_ = builder.BuildAndStart(); } |