Simplify logic of REST request suffix parsing. #6648

Merged
merged 1 commit into from Sep 8, 2015

Conversation

Projects
None yet
6 participants
@domob1812
Contributor

domob1812 commented Sep 7, 2015

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.

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.
@jgarzik

This comment has been minimized.

Show comment
Hide comment
@jgarzik

jgarzik Sep 7, 2015

Contributor

ut ACK - I like it

Contributor

jgarzik commented Sep 7, 2015

ut ACK - I like it

@sipa

This comment has been minimized.

Show comment
Hide comment
@sipa

sipa Sep 7, 2015

Member

utACK

Member

sipa commented Sep 7, 2015

utACK

@dcousens

This comment has been minimized.

Show comment
Hide comment
@dcousens

dcousens Sep 8, 2015

Contributor

utACK

Contributor

dcousens commented Sep 8, 2015

utACK

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Sep 8, 2015

Member

Definitively cleaner.
utACK.

Member

jonasschnelli commented Sep 8, 2015

Definitively cleaner.
utACK.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Sep 8, 2015

Member

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

Member

laanwj commented Sep 8, 2015

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

@laanwj laanwj added the RPC/REST/ZMQ label Sep 8, 2015

}
+ param = strReq.substr(0, pos);
+ const std::string suff(strReq, pos + 1);

This comment has been minimized.

@laanwj

laanwj Sep 8, 2015

Member

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

@laanwj

laanwj Sep 8, 2015

Member

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

@laanwj laanwj merged commit 9cdc335 into bitcoin:master Sep 8, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Sep 8, 2015

Merge pull request #6648
9cdc335 Simplify logic of REST request suffix parsing. (Daniel Kraft)

@domob1812 domob1812 deleted the domob1812:rest-param branch Sep 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment