RPC: form basis of RPC API versioning, and declare current one v1 #452

pull jgarzik wants to merge 1 commits into bitcoin:master from jgarzik:rpc-api-ver changing 1 files +54 −6
  1. jgarzik commented at 7:16 PM on August 4, 2011: contributor

    RPC server will now accept and parse /api/v%d URLs. Any version other than one (/api/v1) will be rejected with 404 not found. URLs outside /api/v%d are ignored by this processing.

    Code heavily inspired by one of cdhowie's commits from #431 which I then pared down quite a bit, and changed the URL portion thereof.

    Credit for the base changes goes to cdhowie (from which I pared down and changed the code).

    The API versioning logic, as I understand it from the satoshi days, was that we should simply change the API as needed, because bitcoin is not yet version 1.0. HOWEVER, the logic continued, we should not simply make breaking changes to RPC API willy nilly, simply because we can. The value of the change must outweight the pain of the change, in other words. Thus, adding new RPC calls was never a problem, but changing RPC calls was avoided.

    I like cdhowie's approach sufficiently to think that there would be value in supporting "/api/v1" URL, to prepare for future versioning.

    Understand, this is NOT a blanket endorsement of pull request #431 with all its changes. This is only designed to add some future proofing in a manner inspired by pull #431.

  2. RPC: form basis of RPC API versioning, and declare current one v1
    RPC server will now accept and parse /api/v%d URLs.  Any version other
    than one (/api/v1) will be rejected with 404 not found.  URLs outside
    /api/v%d are ignored by this processing.
    
    Credit to 'cdhowie' for original code, which I stripped down quite
    a bit from there.
    923463a05b
  3. in src/rpc.cpp:None in e4be8d1887 outdated
    2209 | +            printf("ThreadRPCServer ReadHTTPRequest timeout\n");
    2210 |              continue;
    2211 |          }
    2212 |  
    2213 | +        if (boost::starts_with(strUrl, "/api/v")) {
    2214 | +            api_version = atoi(&(strUrl.c_str())[10]);
    


    gavinandresen commented at 6:09 PM on August 8, 2011:

    Where does the magic '10' come from? "/api/v" is 6 chars long....

  4. jgarzik commented at 8:11 PM on August 8, 2011: contributor

    fixed

  5. alexwaters commented at 8:06 AM on September 30, 2011: contributor

    The pull has become unmergeable (without conflicts), and will be closed in 15 days from this message if action is not taken.

    To prevent closure, kindly rebase the pull to merge cleanly with the current codebase. If a time extension is needed, please respond to this comment or contact QA@BitcoinTesting.org.

  6. alexwaters commented at 5:58 AM on October 20, 2011: contributor

    Closed pending rebase / additional commentary. The rebase label has been applied.

  7. alexwaters closed this on Oct 20, 2011

  8. jgarzik deleted the branch on Aug 24, 2014
  9. zathras-crypto referenced this in commit 50d3356d08 on Jan 24, 2017
  10. ptschip referenced this in commit 42f478edf9 on May 2, 2017
  11. sipa referenced this in commit fa140ae276 on May 3, 2017
  12. sipa referenced this in commit e7c1b4490f on May 5, 2017
  13. lateminer referenced this in commit 79e7a13b07 on Jan 22, 2019
  14. fjahr referenced this in commit cbc20b8c34 on Jul 24, 2019
  15. 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