summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conf_validation.c
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2020-11-17 16:50:06 +0300
committerValentin Bartenev <vbart@nginx.com>2020-11-17 16:50:06 +0300
commitfb80502513bf0140c5e595714967f75ea3e1e5d3 (patch)
treeaaae048262ab410d3fad7912e1dcbaf233188b79 /src/nxt_conf_validation.c
parente7d66acda726490fb7b8da03f0d4788857918d5a (diff)
downloadunit-fb80502513bf0140c5e595714967f75ea3e1e5d3.tar.gz
unit-fb80502513bf0140c5e595714967f75ea3e1e5d3.tar.bz2
HTTP parser: allowed more characters in header field names.
Previously, all requests that contained in header field names characters other than alphanumeric, or "-", or "_" were rejected with a 400 "Bad Request" error response. Now, the parser allows the same set of characters as specified in RFC 7230, including: "!", "#", "$", "%", "&", "'", "*", "+", ".", "^", "`", "|", and "~". Header field names that contain only these characters are considered valid. Also, there's a new option introduced: "discard_unsafe_fields". It accepts boolean value and it is set to "true" by default. When this option is "true", all header field names that contain characters in valid range, but other than alphanumeric or "-" are skipped during parsing. When the option is "false", these header fields aren't skipped. Requests with non-valid characters in header field names according to RFC 7230 are rejected regardless of "discard_unsafe_fields" setting. This closes #422 issue on GitHub.
Diffstat (limited to 'src/nxt_conf_validation.c')
-rw-r--r--src/nxt_conf_validation.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c
index dca56881..f4e7c358 100644
--- a/src/nxt_conf_validation.c
+++ b/src/nxt_conf_validation.c
@@ -274,6 +274,9 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_http_members[] = {
.name = nxt_string("body_temp_path"),
.type = NXT_CONF_VLDT_STRING,
}, {
+ .name = nxt_string("discard_unsafe_fields"),
+ .type = NXT_CONF_VLDT_BOOLEAN,
+ }, {
.name = nxt_string("websocket"),
.type = NXT_CONF_VLDT_OBJECT,
.validator = nxt_conf_vldt_object,