Changeset View
Changeset View
Standalone View
Standalone View
src/httprpc.cpp
Show First 20 Lines • Show All 309 Lines • ▼ Show 20 Lines | try { | ||||
// Set the URI | // Set the URI | ||||
jreq.URI = req->GetURI(); | jreq.URI = req->GetURI(); | ||||
std::string strReply; | std::string strReply; | ||||
// singleton request | // singleton request | ||||
if (valRequest.isObject()) { | if (valRequest.isObject()) { | ||||
jreq.parse(valRequest); | jreq.parse(valRequest); | ||||
UniValue result = tableRPC.execute(config, jreq); | UniValue result = rpcServer.ExecuteCommand(config, jreq); | ||||
// Send reply | // Send reply | ||||
strReply = JSONRPCReply(result, NullUniValue, jreq.id); | strReply = JSONRPCReply(result, NullUniValue, jreq.id); | ||||
} else if (valRequest.isArray()) { | } else if (valRequest.isArray()) { | ||||
// array of requests | // array of requests | ||||
strReply = JSONRPCExecBatch(config, jreq, valRequest.get_array()); | strReply = JSONRPCExecBatch(config, rpcServer, jreq, | ||||
valRequest.get_array()); | |||||
} else { | } else { | ||||
throw JSONRPCError(RPC_PARSE_ERROR, "Top-level object parse error"); | throw JSONRPCError(RPC_PARSE_ERROR, "Top-level object parse error"); | ||||
} | } | ||||
req->WriteHeader("Content-Type", "application/json"); | req->WriteHeader("Content-Type", "application/json"); | ||||
req->WriteReply(HTTP_OK, strReply); | req->WriteReply(HTTP_OK, strReply); | ||||
} catch (const UniValue &objError) { | } catch (const UniValue &objError) { | ||||
JSONErrorReply(req, objError, jreq.id); | JSONErrorReply(req, objError, jreq.id); | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |