Two follow-ups to #34342
First commit: An empty body was not treated as a complete response. We currently check if Content-Length is greater than zero instead of whether the header was sent, so a response with a Content-Length of 0 falls into the branch for responses that carry no length and confinues to read until the peer disconnects. Our server sends an empty body with several types of errors such as a wrong RPC password but it does close the connection as well, which mitigates this from causing any serious issue. However, it would still be good to handle this correctly on the client side that we don't have to rely on the server to save us from hanging.
b-l-u-e found this in post-merge review in #34342 (review) but I didn't manage to look into it until now.
Second commit: -rpcclienttimeout no longer measures real idle time. Before the libevent removal, it used to mean give up if really nothing arrives for this long, and any newly incoming data did reset the counter. With the new code the countdown ignores progress, so a large/slow response could be cut off while data still arrives. Revert this to the old behavior.
The second commit does not have a test because I didn't manage to construct one that didn't turn out to be flaky. It may be possible but I couldn't come up with something within a scope of complexity that seems reasonable for this.