test: regression test for incomplete/corrupted hdr

Add regression test that verifies that old bugs regarding corrupted
and incomplete headers are fixed.

(D512233 + D570451, orig authors brianp@fb.com + jtarnawski@fb.com)

PR-URL: https://github.com/joyent/http-parser/pull/236
Reviewed-By: Fedor Indutny <fedor@indutny.com>
make-http-max-header-size-gyp-configurable
Kjell Schubert 10 years ago committed by Fedor Indutny
parent 5d414fcb4b
commit 2872cb7e6a

@ -3619,6 +3619,22 @@ main (void)
"\r\n"; "\r\n";
test_simple(dumbfuck2, HPE_OK); test_simple(dumbfuck2, HPE_OK);
const char *corrupted_connection =
"GET / HTTP/1.1\r\n"
"Host: www.example.com\r\n"
"Connection\r\033\065\325eep-Alive\r\n"
"Accept-Encoding: gzip\r\n"
"\r\n";
test_simple(corrupted_connection, HPE_INVALID_HEADER_TOKEN);
const char *corrupted_header_name =
"GET / HTTP/1.1\r\n"
"Host: www.example.com\r\n"
"X-Some-Header\r\033\065\325eep-Alive\r\n"
"Accept-Encoding: gzip\r\n"
"\r\n";
test_simple(corrupted_header_name, HPE_INVALID_HEADER_TOKEN);
#if 0 #if 0
// NOTE(Wed Nov 18 11:57:27 CET 2009) this seems okay. we just read body // NOTE(Wed Nov 18 11:57:27 CET 2009) this seems okay. we just read body
// until EOF. // until EOF.

Loading…
Cancel
Save