Fix null id in RPC response during startup#6362
Merged
laanwj merged 1 commit intobitcoin:masterfrom Jul 2, 2015
Merged
Conversation
request object before returning an error so that id value can be used in the response. Prior to this commit, RPC commands sent during Bitcoin's warmup/startup phase were responded to with a JSON-RPC error with an id of null, which violated the JSON-RPC 2.0 spec: id: This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
Member
|
Good catch. The new place is better in any case because this also catches other invocations of CRPCTable::execute, such as from the GUI. Tested ACK. |
Contributor
|
utACK. |
Member
|
@jonasschnelli the code is moved from HTTPReq_JSONRPC to CRPCTable::execute, both is downstream from REST/HTTP selection, so RESTS cannot be affected. REST should do its own check and raise its own error, which has nothing to do with JSONRPCError. Here's the same check for REST: https://github.com/bitcoin/bitcoin/blob/master/src/rest.cpp#L556 |
Contributor
|
Sorry. Right, there are no changes for REST calls. |
laanwj
added a commit
that referenced
this pull request
Jul 2, 2015
72b9452 When processing RPC commands during warmup phase, parse the request object before returning an error so that id value can be used in the response. (Forrest Voight)
luke-jr
pushed a commit
to luke-jr/bitcoin
that referenced
this pull request
Jan 10, 2016
request object before returning an error so that id value can be used in the response. Prior to this commit, RPC commands sent during Bitcoin's warmup/startup phase were responded to with a JSON-RPC error with an id of null, which violated the JSON-RPC 2.0 spec: id: This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null. Github-Pull: bitcoin#6362 Rebased-From: 72b9452
luke-jr
pushed a commit
to luke-jr/bitcoin
that referenced
this pull request
Jan 10, 2016
request object before returning an error so that id value can be used in the response. Prior to this commit, RPC commands sent during Bitcoin's warmup/startup phase were responded to with a JSON-RPC error with an id of null, which violated the JSON-RPC 2.0 spec: id: This member is REQUIRED. It MUST be the same as the value of the id member in the Request Object. If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null. Github-Pull: bitcoin#6362 Rebased-From: 72b9452
zkbot
added a commit
to zcash/zcash
that referenced
this pull request
Mar 4, 2017
Bitcoin 0.12 RPC PRs 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6266 - bitcoin/bitcoin#6257 - bitcoin/bitcoin#6271 - bitcoin/bitcoin#6158 - bitcoin/bitcoin#6307 - bitcoin/bitcoin#6290 - bitcoin/bitcoin#6262 - bitcoin/bitcoin#6088 - bitcoin/bitcoin#6339 - bitcoin/bitcoin#6299 (partial, remainder in #2099) - bitcoin/bitcoin#6350 - bitcoin/bitcoin#6247 - bitcoin/bitcoin#6362 - bitcoin/bitcoin#5486 - bitcoin/bitcoin#6417 - bitcoin/bitcoin#6398 (partial, remainder was included in #1950) - bitcoin/bitcoin#6444 - bitcoin/bitcoin#6456 (partial, remainder was included in #2082) - bitcoin/bitcoin#6380 - bitcoin/bitcoin#6970 Part of #2074.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When processing RPC commands during warmup phase, parse the
request object before returning an error so that id value can
be used in the response.
Prior to this commit, RPC commands sent during Bitcoin's
warmup/startup phase were responded to with a JSON-RPC error
with an id of null, which violated the JSON-RPC 2.0 spec:
id: This member is REQUIRED. It MUST be the same as the value
of the id member in the Request Object. If there was an error
in detecting the id in the Request object (e.g. Parse
error/Invalid Request), it MUST be Null.