HTTP parser: improved error reporting.

This commit is contained in:
Valentin Bartenev
2018-01-15 20:49:59 +03:00
parent 819b43fc2d
commit 3fb140d6d2
4 changed files with 59 additions and 32 deletions

View File

@@ -101,27 +101,27 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
},
{
nxt_string("GEt / HTTP/1.0\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
nxt_string("GET /\0 HTTP/1.0\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
nxt_string("GET /\r HTTP/1.0\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
nxt_string("GET /\n HTTP/1.0\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
nxt_string("GET / HTTP/1.0\r\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
@@ -230,13 +230,13 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{
nxt_string("GET / HTTP/1.1\r\n"
"Host example.com\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
nxt_string("GET / HTTP/1.1\r\n"
":Host: example.com\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
@@ -248,25 +248,25 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{
nxt_string("GET / HTTP/1.1\r\n"
"Ho\0st: example.com\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
nxt_string("GET / HTTP/1.1\r\n"
"Ho\rst: example.com\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
nxt_string("GET / HTTP/1.1\r\n"
"Host: exa\0mple.com\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{
nxt_string("GET / HTTP/1.1\r\n"
"Host: exa\rmple.com\r\n\r\n"),
NXT_ERROR,
NXT_HTTP_PARSE_INVALID,
NULL, { NULL }
},
{