aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-12-11 20:41:20 -0800
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-12-11 20:41:20 -0800
commit2a572091b723ca30f7e492ad09c704f7800aad6b (patch)
tree42a5b912aa46ad199364b37857d58fe382ace0dc /test
parent1aa50eb2c493d9617787b1912425a12277bda006 (diff)
parenteb597e451385c3dd706795615e735607a31b38b5 (diff)
Merge pull request #4428 from ctiller/httpness
Hit remaining corner cases in httpcli/parser.c
Diffstat (limited to 'test')
-rw-r--r--test/core/httpcli/parser_test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/core/httpcli/parser_test.c b/test/core/httpcli/parser_test.c
index dacec0f72f..b96814dd41 100644
--- a/test/core/httpcli/parser_test.c
+++ b/test/core/httpcli/parser_test.c
@@ -38,6 +38,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
@@ -123,6 +124,7 @@ int main(int argc, char **argv) {
size_t i;
const grpc_slice_split_mode split_modes[] = {GRPC_SLICE_SPLIT_IDENTITY,
GRPC_SLICE_SPLIT_ONE_BYTE};
+ char *tmp1, *tmp2;
grpc_test_init(argc, argv);
@@ -149,6 +151,19 @@ int main(int argc, char **argv) {
test_fails(split_modes[i], "HTTP/1.0 200 OK\n");
test_fails(split_modes[i], "HTTP/1.0 200 OK\r\n");
test_fails(split_modes[i], "HTTP/1.0 200 OK\r\nFoo x\r\n");
+ test_fails(split_modes[i],
+ "HTTP/1.0 200 OK\r\n"
+ "xyz: abc\r\n"
+ " def\r\n"
+ "\r\n"
+ "hello world!");
+
+ tmp1 = gpr_malloc(2 * GRPC_HTTPCLI_MAX_HEADER_LENGTH);
+ memset(tmp1, 'a', 2 * GRPC_HTTPCLI_MAX_HEADER_LENGTH);
+ gpr_asprintf(&tmp2, "HTTP/1.0 200 OK\r\nxyz: %s\r\n\r\n", tmp1);
+ test_fails(split_modes[i], tmp2);
+ gpr_free(tmp1);
+ gpr_free(tmp2);
}
return 0;