From 6352c21a58d66db99f8f981c37e6d57e62fc24a2 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Tue, 17 Sep 2019 18:40:21 +0300 Subject: 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. --- src/test/nxt_http_parse_test.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/test') diff --git a/src/test/nxt_http_parse_test.c b/src/test/nxt_http_parse_test.c index 6fbda25a..5498cb1f 100644 --- a/src/test/nxt_http_parse_test.c +++ b/src/test/nxt_http_parse_test.c @@ -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 -- cgit