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