Simplify logic of REST request suffix parsing. #6648

pull domob1812 wants to merge 1 commits into bitcoin:master from domob1812:rest-param changing 1 files +32 −25
  1. domob1812 commented at 6:39 PM on September 7, 2015: contributor

    This patch changes the way the suffix (giving the requested data format) is parsed for REST requests. Before, the string was split at '.' characters and it was assumed that the second part was the suffix.

    Now, we look for the last dot and use that to determine the suffix. This allows for strings that contain dots (not used now, though), and seems, in general, to be clearer and more intuitive.

  2. Simplify logic of REST request suffix parsing.
    This patch changes the way the suffix (giving the requested data format) is
    parsed for REST requests.  Before, the string was split at '.'
    characters and it was assumed that the second part was the suffix.
    
    Now, we look for the last dot and use that to determine the suffix.
    This allows for strings that contain dots (not used now, though), and
    seems, in general, to be clearer and more intuitive.
    9cdc3353c5
  3. jgarzik commented at 11:44 PM on September 7, 2015: contributor

    ut ACK - I like it

  4. sipa commented at 11:57 PM on September 7, 2015: member

    utACK

  5. dcousens commented at 1:04 AM on September 8, 2015: contributor

    utACK

  6. jonasschnelli commented at 11:29 AM on September 8, 2015: contributor

    Definitively cleaner. utACK.

  7. laanwj commented at 12:41 PM on September 8, 2015: member

    Looks good to me. utACK (but the tests cover this).

  8. laanwj added the label RPC on Sep 8, 2015
  9. in src/rest.cpp:None in 9cdc3353c5
      85 | +        param = strReq;
      86 | +        return rf_names[0].rf;
      87 |      }
      88 |  
      89 | +    param = strReq.substr(0, pos);
      90 | +    const std::string suff(strReq, pos + 1);
    


    laanwj commented at 12:45 PM on September 8, 2015:

    Didn't even know std::string had a substring constructor. Nice.

  10. laanwj merged this on Sep 8, 2015
  11. laanwj closed this on Sep 8, 2015

  12. laanwj referenced this in commit cd381d7719 on Sep 8, 2015
  13. domob1812 deleted the branch on Sep 8, 2015
  14. 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