HTTP parser: relaxed checking of fields values.

Allowing characters up to 0xFF doesn't conflict with RFC 7230.
Particularly, this make it possible to pass unencoded UTF-8 data
through HTTP headers, which can be useful.
This commit is contained in:
Valentin Bartenev
2018-07-03 15:18:16 +03:00
parent 0366bfad6d
commit 11cecce114
2 changed files with 2 additions and 3 deletions

View File

@@ -699,8 +699,7 @@ nxt_http_lookup_field_end(u_char *p, u_char *end)
#define nxt_field_end_test_char(ch) \ #define nxt_field_end_test_char(ch) \
\ \
/* Values below 0x20 become more than 0xDF. */ \ if (nxt_slow_path((ch) < 0x20)) { \
if (nxt_slow_path((u_char) ((ch) - 0x20) > 0x5E)) { \
return &(ch); \ return &(ch); \
} }

View File

@@ -301,7 +301,7 @@ static nxt_http_parse_test_case_t nxt_http_test_cases[] = {
{ {
nxt_string("GET / HTTP/1.1\r\n" nxt_string("GET / HTTP/1.1\r\n"
"Host: пример.испытание\r\n\r\n"), "Host: пример.испытание\r\n\r\n"),
NXT_HTTP_PARSE_INVALID, NXT_DONE,
NULL, { NULL } NULL, { NULL }
}, },
{ {