aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/bad_client/tests
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-12-09 08:58:47 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-12-09 08:58:47 -0800
commit25fd57117d2c6849d48b1bac1eccd5b6223bc3a2 (patch)
tree954602332a6855a68099bb3c3edee7cda6dca8fe /test/core/bad_client/tests
parentf4786c236115727c83bacb441a0558ce5c28ce8d (diff)
Catch bad timeout handling
Diffstat (limited to 'test/core/bad_client/tests')
-rw-r--r--test/core/bad_client/tests/bad_timeout.headers2
-rw-r--r--test/core/bad_client/tests/headers.c16
-rw-r--r--test/core/bad_client/tests/simple_request.c12
3 files changed, 29 insertions, 1 deletions
diff --git a/test/core/bad_client/tests/bad_timeout.headers b/test/core/bad_client/tests/bad_timeout.headers
new file mode 100644
index 0000000000..60c37b9ff6
--- /dev/null
+++ b/test/core/bad_client/tests/bad_timeout.headers
@@ -0,0 +1,2 @@
+# a badly encoded timeout value
+grpc-timeout: 15 seconds \ No newline at end of file
diff --git a/test/core/bad_client/tests/headers.c b/test/core/bad_client/tests/headers.c
index 5547aca210..4b409caad4 100644
--- a/test/core/bad_client/tests/headers.c
+++ b/test/core/bad_client/tests/headers.c
@@ -217,5 +217,21 @@ int main(int argc, char **argv) {
"\x00\x00\x00\x01\x39\x67\xed\x1d\x64",
GRPC_BAD_CLIENT_DISCONNECT);
+ /* a badly encoded timeout value */
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
+ "\x00\x00\x19\x01\x04\x00\x00\x00\x01"
+ "\x10\x0cgrpc-timeout\x0a"
+ "15 seconds",
+ GRPC_BAD_CLIENT_DISCONNECT);
+ /* a badly encoded timeout value: twice (catches caching) */
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
+ "\x00\x00\x19\x01\x04\x00\x00\x00\x01"
+ "\x10\x0cgrpc-timeout\x0a"
+ "15 seconds"
+ "\x00\x00\x19\x01\x04\x00\x00\x00\x03"
+ "\x10\x0cgrpc-timeout\x0a"
+ "15 seconds",
+ GRPC_BAD_CLIENT_DISCONNECT);
+
return 0;
}
diff --git a/test/core/bad_client/tests/simple_request.c b/test/core/bad_client/tests/simple_request.c
index 7cd46821f4..b6c3b65ac3 100644
--- a/test/core/bad_client/tests/simple_request.c
+++ b/test/core/bad_client/tests/simple_request.c
@@ -85,8 +85,18 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq) {
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
- /* partial http2 header prefixes */
+ /* basic request: check that things are working */
GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR, 0);
+ /* push an illegal data frame */
+ GRPC_RUN_BAD_CLIENT_TEST(verifier, PFX_STR
+ "\x00\x00\x05\x00\x00\x00\x00\x00\x01"
+ "\x34\x00\x00\x00\x00",
+ 0);
+
+ /* push a data frame with bad flags */
+ GRPC_RUN_BAD_CLIENT_TEST(verifier,
+ PFX_STR "\x00\x00\x00\x00\x02\x00\x00\x00\x01", 0);
+
return 0;
}