Support JSON-RPC 2.0 request batches #1512

pull jgarzik wants to merge 2 commits into bitcoin:master from jgarzik:json-batch changing 1 files +101 −32
  1. jgarzik commented at 6:06 AM on June 24, 2012: contributor

    This enables bundling multiple JSON-RPC requests within a single HTTP request, inside a JSON array. The response is a JSON array, containing one JSON-RPC response per input request.

    Specification: http://www.jsonrpc.org/specification#batch

    Testing notes: I have done a quick "it works" batch test with curl, as well as the usual RPC testing to make sure nothing broke. More elaborate testing is welcome.

  2. gavinandresen commented at 3:14 PM on June 27, 2012: contributor

    Trying the batch examples at http://www.jsonrpc.org/specification ... the implementation isn't matching the spec.

    E.g.

    curl --user abc:123 --data-binary '[1,2,3]' -H 'content-type: text/plain;' http://127.0.0.1:9000/

    ... is returning error -32700, "value is type int, expected obj" instead of -32600, "Invalid request".

  3. jgarzik commented at 5:56 PM on June 27, 2012: contributor

    Rebased, and fixed bug reported by @gavinandresen (note: turned out not to be a policy decision, as I claimed on IRC)

  4. RPC: break out high level JSON-RPC req/resp into their own functions
    This prepares for JSON-RPC 2.0 batches.
    c6494d82fa
  5. RPC: add support for JSON-RPC 2.0-style request batching
    If the top-level object is an array, it is assumed to be an array of
    JSON-RPC requests.  An array is returned, containing one response (error or
    not) per request, in the order submitted.
    
    In a slight change in semantics, batched requests -always- return
    an HTTP 200 OK status, even ones full of invalid or incorrect requests.
    613389019e
  6. jgarzik referenced this in commit c729dbb6d2 on Jul 4, 2012
  7. jgarzik merged this on Jul 4, 2012
  8. jgarzik closed this on Jul 4, 2012

  9. nifgraup referenced this in commit c69383d218 on Mar 30, 2014
  10. jgarzik deleted the branch on Aug 24, 2014
  11. suprnurd referenced this in commit 916af52c0a on Dec 5, 2017
  12. lateminer referenced this in commit 7e93e12428 on Jan 22, 2019
  13. lateminer referenced this in commit 24bc866346 on May 6, 2020
  14. DrahtBot 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-20 00:16 UTC

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