summaryrefslogtreecommitdiff
path: root/src/XmlRpcMethodImpl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/XmlRpcMethodImpl.cc')
-rw-r--r--src/XmlRpcMethodImpl.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/XmlRpcMethodImpl.cc b/src/XmlRpcMethodImpl.cc
index 4e2a9007..1b9edb74 100644
--- a/src/XmlRpcMethodImpl.cc
+++ b/src/XmlRpcMethodImpl.cc
@@ -63,6 +63,7 @@
#include "SegmentMan.h"
#include "TimedHaltCommand.h"
#include "PeerStat.h"
+#include "Base64.h"
#ifdef ENABLE_BITTORRENT
# include "bittorrent_helper.h"
# include "BtRegistry.h"
@@ -266,7 +267,11 @@ SharedHandle<ValueBase> AddTorrentXmlRpcMethod::process
if(!torrentParam) {
throw DL_ABORT_EX("Torrent data is not provided.");
}
-
+ SharedHandle<String> tempTorrentParam;
+ if(getJsonRpc()) {
+ tempTorrentParam = String::g(Base64::decode(torrentParam->s()));
+ torrentParam = tempTorrentParam.get();
+ }
std::vector<std::string> uris;
extractUris(std::back_inserter(uris), req.getListParam(1));
@@ -309,7 +314,11 @@ SharedHandle<ValueBase> AddMetalinkXmlRpcMethod::process
if(!metalinkParam) {
throw DL_ABORT_EX("Metalink data is not provided.");
}
-
+ SharedHandle<String> tempMetalinkParam;
+ if(getJsonRpc()) {
+ tempMetalinkParam = String::g(Base64::decode(metalinkParam->s()));
+ metalinkParam = tempMetalinkParam.get();
+ }
SharedHandle<Option> requestOption(new Option(*e->getOption()));
gatherRequestOption(requestOption, req.getDictParam(1));