client: fix incorrectly emitting HTTP 413 for certain content lengths
authorJo-Philipp Wich <jo@mein.io>
Sun, 30 Oct 2022 23:53:29 +0000 (00:53 +0100)
committerJo-Philipp Wich <jo@mein.io>
Mon, 31 Oct 2022 00:03:41 +0000 (01:03 +0100)
commit23977554d9694d025eada50a5547e99ee1be7838
treee490da9902fe9c9e829a75bececca540ee9d78bc
parente3395cd90bed9b7b9fc319e79528fedcc0d947fe
client: fix incorrectly emitting HTTP 413 for certain content lengths

The existing logic for checking overlong request headers did not take
into account that when the request body content length is a multiple
of 4096, the request handling state might transition directly from
CLIENT_STATE_HEADER or CLIENT_STATE_DATA to CLIENT_STATE_DONE, in
which case we must not emit a stray HTTP 413 error.

Fixes: https://github.com/openwrt/luci/issues/2051
Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
[Change commit subject, add commit message, swap order of conditions]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
client.c