mirror of https://github.com/aria2/aria2
Allowed missing params in system.multicall RPC method.
parent
2d92571cf9
commit
d1885a5874
|
@ -1380,11 +1380,9 @@ SharedHandle<ValueBase> SystemMulticallRpcMethod::process
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const String* methodName = asString(methodDict->get(KEY_METHOD_NAME));
|
const String* methodName = asString(methodDict->get(KEY_METHOD_NAME));
|
||||||
const List* paramsList = asList(methodDict->get(KEY_PARAMS));
|
if(!methodName) {
|
||||||
|
|
||||||
if(!methodName || !paramsList) {
|
|
||||||
list->append(createErrorResponse
|
list->append(createErrorResponse
|
||||||
(DL_ABORT_EX("Missing methodName or params."), req));
|
(DL_ABORT_EX("Missing methodName."), req));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(methodName->s() == getMethodName()) {
|
if(methodName->s() == getMethodName()) {
|
||||||
|
@ -1392,9 +1390,15 @@ SharedHandle<ValueBase> SystemMulticallRpcMethod::process
|
||||||
(DL_ABORT_EX("Recursive system.multicall forbidden."), req));
|
(DL_ABORT_EX("Recursive system.multicall forbidden."), req));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
const SharedHandle<ValueBase>& tempParamsList = methodDict->get(KEY_PARAMS);
|
||||||
|
SharedHandle<List> paramsList;
|
||||||
|
if(asList(tempParamsList)) {
|
||||||
|
paramsList = static_pointer_cast<List>(tempParamsList);
|
||||||
|
} else {
|
||||||
|
paramsList = List::g();
|
||||||
|
}
|
||||||
SharedHandle<RpcMethod> method = RpcMethodFactory::create(methodName->s());
|
SharedHandle<RpcMethod> method = RpcMethodFactory::create(methodName->s());
|
||||||
RpcRequest innerReq
|
RpcRequest innerReq(methodName->s(), paramsList);
|
||||||
(methodName->s(), static_pointer_cast<List>(methodDict->get(KEY_PARAMS)));
|
|
||||||
innerReq.jsonRpc = req.jsonRpc;
|
innerReq.jsonRpc = req.jsonRpc;
|
||||||
RpcResponse res = method->execute(innerReq, e);
|
RpcResponse res = method->execute(innerReq, e);
|
||||||
if(res.code == 0) {
|
if(res.code == 0) {
|
||||||
|
|
|
@ -1129,10 +1129,7 @@ void RpcMethodTest::testSystemMulticall()
|
||||||
asInteger
|
asInteger
|
||||||
(asDict(resParams->get(4))->get("faultCode"))
|
(asDict(resParams->get(4))->get("faultCode"))
|
||||||
->i());
|
->i());
|
||||||
CPPUNIT_ASSERT_EQUAL((int64_t)1,
|
CPPUNIT_ASSERT(asList(resParams->get(5)));
|
||||||
asInteger
|
|
||||||
(asDict(resParams->get(5))->get("faultCode"))
|
|
||||||
->i());
|
|
||||||
CPPUNIT_ASSERT(asList(resParams->get(6)));
|
CPPUNIT_ASSERT(asList(resParams->get(6)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue