Repository navigation
Description
Describe the bug
With --client-type rpc, every request fails when the server sends its JSON-RPC responses with Transfer-Encoding: chunked:
The server replied with a chunked response which is not supported
bitcoincore_rpc::Client::new always uses jsonrpc's simple_http transport, which only reads Content-Length responses. Bitcoin Core is not affected, but servers that send chunked responses, such as libbitcoin-server's bitcoind-compatible endpoint, cannot be used.
To Reproduce
- Run an RPC server that sends chunked responses (e.g. libbitcoin-server with its
[bitcoind]endpoint enabled). - Configure a wallet with
--client-type rpc --url http://127.0.0.1:<port> --basic-auth <user>:<pass>. - Run
wallet full_scan; it fails with the error above.
Expected behavior
The scan completes, as it does against Bitcoin Core. jsonrpc's minreq_http transport reads chunked responses, and bitcoincore-rpc 0.19 already enables it.
Build environment
- BDK-CLI tag/commit: v4.0.0 and master 1c8026e
- OS+version: Debian bookworm (rust:1-bookworm container)
- Rust/Cargo version: 1.100.0
- Rust/Cargo target: x86_64-unknown-linux-gnu
Additional context
The error comes from jsonrpc's simple_http transport, which bitcoincore-rpc's Client::new always uses. Its documentation describes it as "a minimal and non standard conforming HTTP 1.0 round-tripper"; it reads only Content-Length bodies. Chunked transfer encoding is HTTP/1.1, so it is not supported by design:
- apoelstra/rust-jsonrpc#105 (2023): reported that
simple_httpdoesn't support chunked encoding and namedminreqas the workaround. The reporter closed it after finding the HTTP 1.0 note in the docs. - apoelstra/rust-jsonrpc#112 (2024): a chunked response surfaced as a confusing JSON decode error. The maintainers agreed it should stay unsupported ("not supported and different backend should be used") and asked for a clear error instead. That request is the source of the current message: "The server replied with a chunked response which is not supported".
Both repositories are now archived (rust-jsonrpc, rust-bitcoincore-rpc; development continues in rust-bitcoin/corepc), so a fix there is not expected. The supported path is the other transport jsonrpc already ships: minreq_http reads chunked and Content-Length responses, and bitcoincore-rpc 0.19 already enables it (jsonrpc = { features = ["minreq_http"] }). Using it only requires bdk-cli to construct the client with Client::from_jsonrpc over that transport instead of Client::new.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady to Review
Activity
Add BDK and Core Lightning to the tested clients, retest lnd publishtx.