| 79 | static bool g_rpc_whitelist_default = false; |
| 80 | |
| 81 | static void JSONErrorReply(HTTPRequest *req, const UniValue &objError, |
| 82 | const UniValue &id) { |
| 83 | // Send error reply from json-rpc error object. |
| 84 | int nStatus = HTTP_INTERNAL_SERVER_ERROR; |
| 85 | int code = objError.find_value("code").getInt<int>(); |
| 86 | |
| 87 | if (code == RPC_INVALID_REQUEST) { |
| 88 | nStatus = HTTP_BAD_REQUEST; |
| 89 | } else if (code == RPC_METHOD_NOT_FOUND) { |
| 90 | nStatus = HTTP_NOT_FOUND; |
| 91 | } |
| 92 | |
| 93 | std::string strReply = JSONRPCReply(NullUniValue, objError, id); |
| 94 | |
| 95 | req->WriteHeader("Content-Type", "application/json"); |
| 96 | req->WriteReply(nStatus, strReply); |
| 97 | } |
| 98 | |
| 99 | /* |
| 100 | * This function checks username and password against -rpcauth entries from |
no test coverage detected