diff options
author | Andrew Clayton <a.clayton@nginx.com> | 2022-05-04 16:13:19 +0100 |
---|---|---|
committer | Andrew Clayton <a.clayton@nginx.com> | 2022-12-13 13:36:30 +0000 |
commit | dad7ef9a12f2cf16f2be011f167fc19b011ffe03 (patch) | |
tree | 1554f476e0c3e626a88f73efd5bf62f823373c5d /src/nxt_conf_validation.c | |
parent | 12e2cbae8a0bf190c8e7d98de6c08aff57d2ae4f (diff) | |
download | unit-dad7ef9a12f2cf16f2be011f167fc19b011ffe03.tar.gz unit-dad7ef9a12f2cf16f2be011f167fc19b011ffe03.tar.bz2 |
Configuration: made large_header_buffer_size a valid setting.
@JanMikes and @tagur87 on GitHub both reported issues with long URLs
that were exceeding the 8192 byte large_header_buffer_size setting,
which resulted in a HTTP 431 error (Request Header Fields Too Large).
This can be resolved in the code by updating the following line in
src/nxt_router.c::nxt_router_conf_create()
skcf->large_header_buffer_size = 8192;
However, requiring users to modify unit and install custom versions is
less than ideal. We could increase the value, but to what?
This commit takes the option of allowing the user to set this option in
their config by making large_header_buffer_size a valid configuration
setting.
large_header_buffer_size is already set by the configuration system in
nxt_router.c it just isn't set as a valid config option in
nxt_conf_validation.c
With this change users can set this option in their config if required
by the following
"settings": {
"http": {
"large_header_buffer_size": 16384
}
},
It retains its default value of 8192 bytes if this is not set.
With this commit, without the above setting or too low a value, with a
long URL you get a 431 error. With the above setting set to a large
enough value, the request is successful.
NOTE: This setting really determines the maximum size of any single
header _value_. Also, unit will try and place multiple values
into a buffer _if_ they fully fit.
NOTE: This is being released as undocumented and subject to change as it
exposes internal workings of unit.
Closes: <https://github.com/nginx/unit/issues/521>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src/nxt_conf_validation.c')
-rw-r--r-- | src/nxt_conf_validation.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c index 0f22c540..218254bf 100644 --- a/src/nxt_conf_validation.c +++ b/src/nxt_conf_validation.c @@ -315,6 +315,9 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_http_members[] = { .name = nxt_string("idle_timeout"), .type = NXT_CONF_VLDT_INTEGER, }, { + .name = nxt_string("large_header_buffer_size"), + .type = NXT_CONF_VLDT_INTEGER, + }, { .name = nxt_string("body_buffer_size"), .type = NXT_CONF_VLDT_INTEGER, }, { |