/* */ #include "XmlRpcMethod.h" #include "DownloadEngine.h" #include "LogFactory.h" #include "RecoverableException.h" #include "message.h" #include "OptionParser.h" #include "OptionHandler.h" #include "Option.h" #include "array_fun.h" #include "download_helper.h" #include "XmlRpcRequest.h" #include "XmlRpcResponse.h" #include "prefs.h" #include "fmt.h" #include "DlAbortEx.h" namespace aria2 { namespace xmlrpc { XmlRpcMethod::XmlRpcMethod() : optionParser_(OptionParser::getInstance()) {} XmlRpcMethod::~XmlRpcMethod() {} SharedHandle XmlRpcMethod::createErrorResponse (const Exception& e) { SharedHandle params = Dict::g(); params->put("faultCode", Integer::g(1)); params->put("faultString", std::string(e.what())); return params; } XmlRpcResponse XmlRpcMethod::execute (const XmlRpcRequest& req, DownloadEngine* e) { try { return XmlRpcResponse(0, process(req, e)); } catch(RecoverableException& e) { A2_LOG_DEBUG_EX(EX_EXCEPTION_CAUGHT, e); return XmlRpcResponse(1, createErrorResponse(e)); } } namespace { template void gatherOption (InputIterator first, InputIterator last, const std::set& allowedOptions, const SharedHandle