HTTP parser: fixed parsing of target after literal space character.

In theory, all space characters in request target must be encoded; however,
some clients may violate the specification.  For the sake of interoperability,
Unit supports unencoded space characters.

Previously, if there was a space character before the extension or arguments
parts, those parts weren't recognized.  Also, quoted symbols and complex
target weren't detected after a space character.
This commit is contained in:
Valentin Bartenev
2019-09-17 18:40:21 +03:00
parent 3b77e402a9
commit 6352c21a58
3 changed files with 63 additions and 3 deletions

View File

@@ -205,6 +205,19 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
0, 0, 1
}}
},
{
nxt_string("GET /na %20me.ext?args HTTP/1.0\r\n\r\n"),
NXT_DONE,
&nxt_http_parse_test_request_line,
{ .request_line = {
nxt_string("GET"),
nxt_string("/na %20me.ext?args"),
nxt_string("ext"),
nxt_string("args"),
"HTTP/1.0",
0, 1, 1
}}
},
{
nxt_string("GET / HTTP/1.0 HTTP/1.1\r\n\r\n"),
NXT_DONE,
@@ -212,7 +225,7 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{ .request_line = {
nxt_string("GET"),
nxt_string("/ HTTP/1.0"),
nxt_null_string,
nxt_string("0"),
nxt_null_string,
"HTTP/1.1",
0, 0, 1