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

Hit remaining corner cases in httpcli/parser.c

parent 12fa8c83
No related branches found
No related tags found
No related merge requests found
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h> #include <grpc/support/useful.h>
#include "test/core/util/slice_splitter.h" #include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h" #include "test/core/util/test_config.h"
...@@ -123,6 +124,7 @@ int main(int argc, char **argv) { ...@@ -123,6 +124,7 @@ int main(int argc, char **argv) {
size_t i; size_t i;
const grpc_slice_split_mode split_modes[] = {GRPC_SLICE_SPLIT_IDENTITY, const grpc_slice_split_mode split_modes[] = {GRPC_SLICE_SPLIT_IDENTITY,
GRPC_SLICE_SPLIT_ONE_BYTE}; GRPC_SLICE_SPLIT_ONE_BYTE};
char *tmp1, *tmp2;
grpc_test_init(argc, argv); grpc_test_init(argc, argv);
...@@ -149,6 +151,19 @@ int main(int argc, char **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\n");
test_fails(split_modes[i], "HTTP/1.0 200 OK\r\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\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; return 0;
......
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