diff options
Diffstat (limited to 'src/HttpServerBodyCommand.cc')
| -rw-r--r-- | src/HttpServerBodyCommand.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/HttpServerBodyCommand.cc b/src/HttpServerBodyCommand.cc index 6c0b58e0..8479f3f8 100644 --- a/src/HttpServerBodyCommand.cc +++ b/src/HttpServerBodyCommand.cc @@ -243,6 +243,7 @@ bool HttpServerBodyCommand::execute() case RPC_TYPE_JSONP: { std::string callback; std::unique_ptr<ValueBase> json; + auto preauthorized = rpc::RpcRequest::MUST_AUTHORIZE; ssize_t error = 0; if(httpServer_->getRequestType() == RPC_TYPE_JSONP) { json::JsonGetParam param = json::decodeGetParams(query); @@ -273,7 +274,8 @@ bool HttpServerBodyCommand::execute() } Dict* jsondict = downcast<Dict>(json); if(jsondict) { - rpc::RpcResponse res = rpc::processJsonRpcRequest(jsondict, e_); + rpc::RpcResponse res = + rpc::processJsonRpcRequest(jsondict, e_, preauthorized); sendJsonRpcResponse(res, callback); } else { List* jsonlist = downcast<List>(json); @@ -283,8 +285,13 @@ bool HttpServerBodyCommand::execute() for(List::ValueType::const_iterator i = jsonlist->begin(), eoi = jsonlist->end(); i != eoi; ++i) { Dict* jsondict = downcast<Dict>(*i); - if(jsondict) { - results.push_back(rpc::processJsonRpcRequest(jsondict, e_)); + if (jsondict) { + auto resp = + rpc::processJsonRpcRequest(jsondict, e_, preauthorized); + if (resp.code == 0) { + preauthorized = rpc::RpcRequest::PREAUTHORIZED; + } + results.push_back(std::move(resp)); } } sendJsonRpcBatchResponse(results, callback); |
