Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify logic of REST request suffix parsing. #6648

Merged
merged 1 commit into from Sep 8, 2015

Conversation

domob1812
Copy link
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.

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
Copy link
Contributor

jgarzik commented Sep 7, 2015

ut ACK - I like it

@sipa
Copy link
Member

sipa commented Sep 7, 2015

utACK

1 similar comment
@dcousens
Copy link
Contributor

dcousens commented Sep 8, 2015

utACK

@jonasschnelli
Copy link
Contributor

Definitively cleaner.
utACK.

@laanwj
Copy link
Member

laanwj commented Sep 8, 2015

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

}

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@laanwj laanwj merged commit 9cdc335 into bitcoin:master Sep 8, 2015
laanwj added a commit that referenced this pull request Sep 8, 2015
9cdc335 Simplify logic of REST request suffix parsing. (Daniel Kraft)
@domob1812 domob1812 deleted the rest-param branch September 8, 2015 14:23
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants