cli: Improve empty-response and fix -rpcclienttimeout regression #36299

pull fjahr wants to merge 2 commits into bitcoin:master from fjahr:2026-09-cli-feedback changing 2 files +41 −23
  1. fjahr commented at 2:48 PM on September 19, 2026: contributor

    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.

  2. cli: Treat a response with Content-Length: 0 as complete b841ab6942
  3. cli: Apply -rpcclienttimeout per socket wait instead of per phase 1805716354
  4. DrahtBot added the label Scripts and tools on Sep 19, 2026
  5. DrahtBot commented at 2:48 PM on September 19, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36299.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-09-21 15:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me