Multi-wallet RPC URI parsing invalid when ending with a slash #11861

issue jackycjh opened this issue on December 11, 2017
  1. jackycjh commented at 5:24 AM on December 11, 2017: contributor

    Using the newer RPC access point for multi-wallet support as described https://bitcoincore.org/en/releases/0.15.0/#multi-wallet-support will not work if the URI ends with a slash ( / ). In other words, all RPCs for multi-wallet would only work if the URI does not end with a slash.

    Expected behavior: Any RPC command (or by using curl ) should work for URI like http://username:password@127.0.0.1:8332/wallet/wallet.dat/ regardless of the ending slash.

    Actual behavior: An error will be return {"result":null,"error":{"code":-18,"message":"Requested wallet does not exist or is not loaded"},"id":"curltext"} even when the wallet name is valid.

    • http://username:password@127.0.0.1:8332/wallet/wallet.dat will work.

    Reproduction steps:

    1. Run curl --data-binary '{"jsonrpc":"1.1","id":"curltext","method":"listreceivedbyaddress","params":[]}' -H 'content-type:text/plain;' http://username:password@127.0.0.1:8332/wallet/wallet.dat/

    Found in Version: 0.15.1 OS: Windows 10 Pro with Ubuntu WSL (if this info matters)

  2. fanquake added the label RPC/REST/ZMQ on Dec 11, 2017
  3. ryanofsky commented at 11:51 AM on December 11, 2017: member

    Current behaviour seems right to me. It seems better to treat slashes as significant, because silently ignoring slashes could break external code that constructs absolute URI's by joining relative URIs.

    More generally, this is supposed to be a programmatic RPC interface, not a human interface, so it makes sense for it to be strict about not accepting invalid input. Though even some regular websites do treat trailing slashes as significant:

    Valid: https://en.wikipedia.org/wiki/Zebra Not found: https://en.wikipedia.org/wiki/Zebra/

    Valid: https://www.nytimes.com/2017/12/11/world/middleeast/saudi-arabia-movie-theaters.html Not found: https://www.nytimes.com/2017/12/11/world/middleeast/saudi-arabia-movie-theaters.html/

  4. jonasschnelli commented at 6:58 PM on December 11, 2017: contributor

    Agree with @ryanofsky

  5. promag commented at 11:17 PM on December 11, 2017: member
  6. jackycjh commented at 4:20 AM on December 12, 2017: contributor

    I see, I guess I was confused by the documentation on bitcoincore.org, perhaps I should create an issue in https://github.com/bitcoin-core/bitcoincore.org to correct its documentation instead.

  7. laanwj closed this on Jan 11, 2018

  8. laanwj referenced this in commit 3c6286873e on Jan 11, 2018
  9. MarcoFalke locked this on Sep 8, 2021

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-04-13 15:15 UTC

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