summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nxt_http_parse.c20
-rw-r--r--src/test/nxt_http_parse_test.c15
2 files changed, 32 insertions, 3 deletions
diff --git a/src/nxt_http_parse.c b/src/nxt_http_parse.c
index 4d806c61..5b009d96 100644
--- a/src/nxt_http_parse.c
+++ b/src/nxt_http_parse.c
@@ -164,6 +164,7 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
{
u_char *p, ch, *after_slash, *exten, *args;
nxt_int_t rc;
+ nxt_bool_t rest;
nxt_http_ver_t ver;
nxt_http_target_traps_e trap;
@@ -256,6 +257,9 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
after_slash = p + 1;
exten = NULL;
args = NULL;
+ rest = 0;
+
+continue_target:
for ( ;; ) {
p++;
@@ -312,6 +316,8 @@ nxt_http_parse_request_line(nxt_http_request_parse_t *rp, u_char **pos,
rest_of_target:
+ rest = 1;
+
for ( ;; ) {
p++;
@@ -378,7 +384,12 @@ space_after_target:
}
rp->space_in_target = 1;
- goto rest_of_target;
+
+ if (rest) {
+ goto rest_of_target;
+ }
+
+ goto continue_target;
}
/* " HTTP/1.1\r\n" or " HTTP/1.1\n" */
@@ -392,7 +403,12 @@ space_after_target:
}
rp->space_in_target = 1;
- goto rest_of_target;
+
+ if (rest) {
+ goto rest_of_target;
+ }
+
+ goto continue_target;
}
nxt_memcpy(ver.str, &p[1], 8);
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
@@ -206,13 +206,26 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
}}
},
{
+ 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,
&nxt_http_parse_test_request_line,
{ .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