mirror of https://github.com/aria2/aria2
2009-05-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --xml-rpc-max-request-size option to limit the size of XML-RPC request.pull/1/head
parent
4c1ed46094
commit
544732b124
|
@ -1,3 +1,8 @@
|
|||
2009-05-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Added --xml-rpc-max-request-size option to limit the size of
|
||||
XML-RPC request.
|
||||
|
||||
2009-05-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Documented XML-RPC API in man page.
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "RecoverableException.h"
|
||||
#include "prefs.h"
|
||||
#include "Option.h"
|
||||
#include "Util.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -103,6 +104,14 @@ bool HttpServerCommand::execute()
|
|||
if(header.isNull()) {
|
||||
_e->commands.push_back(this);
|
||||
return false;
|
||||
} else if(static_cast<uint64_t>
|
||||
(_e->option->getAsInt(PREF_XML_RPC_MAX_REQUEST_SIZE)) <
|
||||
_httpServer->getContentLength()) {
|
||||
logger->info("Request too long. ContentLength=%s."
|
||||
" See --xml-rpc-max-request-size option to loose"
|
||||
" this limitation.",
|
||||
Util::uitos(_httpServer->getContentLength()).c_str());
|
||||
return true;
|
||||
} else {
|
||||
Command* command = new HttpServerBodyCommand(cuid, _httpServer, _e,
|
||||
_socket);
|
||||
|
|
|
@ -400,6 +400,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
|||
op->addTag(TAG_ADVANCED);
|
||||
handlers.push_back(op);
|
||||
}
|
||||
{
|
||||
SharedHandle<OptionHandler> op(new UnitNumberOptionHandler
|
||||
(PREF_XML_RPC_MAX_REQUEST_SIZE,
|
||||
TEXT_XML_RPC_MAX_REQUEST_SIZE,
|
||||
"2M",
|
||||
0));
|
||||
op->addTag(TAG_ADVANCED);
|
||||
handlers.push_back(op);
|
||||
}
|
||||
{
|
||||
SharedHandle<OptionHandler> op(new DefaultOptionHandler
|
||||
(PREF_XML_RPC_USER,
|
||||
|
|
|
@ -167,6 +167,8 @@ const std::string PREF_REUSE_URI("reuse-uri");
|
|||
const std::string PREF_XML_RPC_USER("xml-rpc-user");
|
||||
// value: string
|
||||
const std::string PREF_XML_RPC_PASSWD("xml-rpc-passwd");
|
||||
// value: 1*digit
|
||||
const std::string PREF_XML_RPC_MAX_REQUEST_SIZE("xml-rpc-max-request-size");
|
||||
// value: string
|
||||
const std::string PREF_ON_DOWNLOAD_START("on-download-start");
|
||||
const std::string PREF_ON_DOWNLOAD_STOP("on-download-stop");
|
||||
|
|
|
@ -171,6 +171,8 @@ extern const std::string PREF_REUSE_URI;
|
|||
extern const std::string PREF_XML_RPC_USER;
|
||||
// value: string
|
||||
extern const std::string PREF_XML_RPC_PASSWD;
|
||||
// value: 1*digit
|
||||
extern const std::string PREF_XML_RPC_MAX_REQUEST_SIZE;
|
||||
// value: string
|
||||
extern const std::string PREF_ON_DOWNLOAD_START;
|
||||
extern const std::string PREF_ON_DOWNLOAD_STOP;
|
||||
|
|
|
@ -491,6 +491,10 @@ _(" --enable-xml-rpc[=true|false] Enable XML-RPC server.\n"\
|
|||
" It is strongly recommended to set username and\n"\
|
||||
" password using --xml-rpc-user and --xml-rpc-passwd\n"\
|
||||
" option. See also --xml-rpc-listen-port option.")
|
||||
#define TEXT_XML_RPC_MAX_REQUEST_SIZE \
|
||||
_(" --xml-rpc-max-request-size=SIZE Set max size of XML-RPC request. If aria2\n"\
|
||||
" detected the request is more than SIZE bytes, it\n"\
|
||||
" drops connection.")
|
||||
#define TEXT_XML_RPC_USER \
|
||||
_(" --xml-rpc-user=USER Set XML-RPC user.")
|
||||
#define TEXT_XML_RPC_PASSWD \
|
||||
|
|
Loading…
Reference in New Issue