rpcserver: Improve JSON-RPC compatibility
In order to avoid compatibility issues with software relying on Core's behavior, terminate HTTP POST JSON-RPC responses with a newline.
This commit is contained in:
parent
0e71867dfe
commit
9799f0e547
1 changed files with 5 additions and 0 deletions
|
@ -4036,6 +4036,11 @@ func (s *rpcServer) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin
|
||||||
if _, err := buf.Write(msg); err != nil {
|
if _, err := buf.Write(msg); err != nil {
|
||||||
rpcsLog.Errorf("Failed to write marshalled reply: %v", err)
|
rpcsLog.Errorf("Failed to write marshalled reply: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Terminate with newline to maintain compatibility with Bitcoin Core.
|
||||||
|
if err := buf.WriteByte('\n'); err != nil {
|
||||||
|
rpcsLog.Errorf("Failed to append terminating newline to reply: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// jsonAuthFail sends a message back to the client if the http auth is rejected.
|
// jsonAuthFail sends a message back to the client if the http auth is rejected.
|
||||||
|
|
Loading…
Reference in a new issue