client: Always close connection with request body in case of error
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 20 Mar 2021 13:41:45 +0000 (14:41 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 21 Mar 2021 21:22:12 +0000 (22:22 +0100)
commit15346de8d3ba422002496526ee24c62a3601ab8c
tree9f1f966a177c44b61c025b324da82ddb35653180
parentf53a63999784bcb7dc513e221f3f25dd3de2f35e
client: Always close connection with request body in case of error

When we run into an error like a 404 Not Found the request body is not
read and will be parsed as part of the next request. The next Request
will then fail because there is unexpected data in it.
When we run into such a problem with a request body close return an
error and close the connection. This should be easier than trying to
recover the state.

We saw this problem when /ubus/ was not installed, but the browser tried
to access it. Then uhttpd returned a 404, but the next request done in
this connection also failed with a HTTP 400, bad request.

Fixes: FS#3378
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
client.c