mirror of https://github.com/aria2/aria2
2009-05-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed --enable-http-server and --http-server-listen-port options. Added --enable-xml-rpc and --xml-rpc-listen-port instead. The original feature for --enable-http-server that reports download progress in HTML was officially removed. Persist XML-RPC connection if client supports keep-alive. * src/DownloadEngineFactory.cc * src/HttpServerCommand.cc * src/HttpServerResponseCommand.cc * src/Makefile.am * src/Makefile.in * src/OptionHandlerFactory.cc * src/RequestGroupMan.cc * src/main.cc * src/option_processing.cc * src/prefs.cc * src/prefs.h * src/usage_text.hpull/1/head
parent
45249392fd
commit
9f0a602ce3
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
2009-05-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Removed --enable-http-server and --http-server-listen-port
|
||||||
|
options. Added --enable-xml-rpc and --xml-rpc-listen-port
|
||||||
|
instead. The original feature for --enable-http-server that
|
||||||
|
reports download progress in HTML was officially removed. Persist
|
||||||
|
XML-RPC connection if client supports keep-alive.
|
||||||
|
* src/DownloadEngineFactory.cc
|
||||||
|
* src/HttpServerCommand.cc
|
||||||
|
* src/HttpServerResponseCommand.cc
|
||||||
|
* src/Makefile.am
|
||||||
|
* src/Makefile.in
|
||||||
|
* src/OptionHandlerFactory.cc
|
||||||
|
* src/RequestGroupMan.cc
|
||||||
|
* src/main.cc
|
||||||
|
* src/option_processing.cc
|
||||||
|
* src/prefs.cc
|
||||||
|
* src/prefs.h
|
||||||
|
* src/usage_text.h
|
||||||
|
|
||||||
2009-05-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-05-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Added "uris" key to the response of tellStatus command. Added
|
Added "uris" key to the response of tellStatus command. Added
|
||||||
|
|
|
@ -63,7 +63,9 @@
|
||||||
#include "SelectEventPoll.h"
|
#include "SelectEventPoll.h"
|
||||||
#include "DlAbortEx.h"
|
#include "DlAbortEx.h"
|
||||||
#include "FileAllocationEntry.h"
|
#include "FileAllocationEntry.h"
|
||||||
|
#ifdef ENABLE_XML_RPC
|
||||||
# include "HttpListenCommand.h"
|
# include "HttpListenCommand.h"
|
||||||
|
#endif // ENABLE_XML_RPC
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -139,15 +141,17 @@ DownloadEngineFactory::newDownloadEngine(Option* op,
|
||||||
stopSec));
|
stopSec));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(op->getAsBool(PREF_ENABLE_HTTP_SERVER)) {
|
#ifdef ENABLE_XML_RPC
|
||||||
|
if(op->getAsBool(PREF_ENABLE_XML_RPC)) {
|
||||||
HttpListenCommand* httpListenCommand =
|
HttpListenCommand* httpListenCommand =
|
||||||
new HttpListenCommand(e->newCUID(), e.get());
|
new HttpListenCommand(e->newCUID(), e.get());
|
||||||
if(httpListenCommand->bindPort(op->getAsInt(PREF_HTTP_SERVER_LISTEN_PORT))){
|
if(httpListenCommand->bindPort(op->getAsInt(PREF_XML_RPC_LISTEN_PORT))){
|
||||||
e->addRoutineCommand(httpListenCommand);
|
e->addRoutineCommand(httpListenCommand);
|
||||||
} else {
|
} else {
|
||||||
delete httpListenCommand;
|
delete httpListenCommand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // ENABLE_XML_RPC
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,12 +33,6 @@
|
||||||
*/
|
*/
|
||||||
/* copyright --> */
|
/* copyright --> */
|
||||||
#include "HttpServerCommand.h"
|
#include "HttpServerCommand.h"
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <ostream>
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
#include "SocketCore.h"
|
#include "SocketCore.h"
|
||||||
#include "DownloadEngine.h"
|
#include "DownloadEngine.h"
|
||||||
#include "HttpServer.h"
|
#include "HttpServer.h"
|
||||||
|
@ -46,12 +40,7 @@
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "RequestGroup.h"
|
#include "RequestGroup.h"
|
||||||
#include "RequestGroupMan.h"
|
#include "RequestGroupMan.h"
|
||||||
#include "BtContext.h"
|
|
||||||
#include "Util.h"
|
|
||||||
#include "HttpServerResponseCommand.h"
|
|
||||||
#include "HttpServerBodyCommand.h"
|
#include "HttpServerBodyCommand.h"
|
||||||
#include "CheckIntegrityEntry.h"
|
|
||||||
#include "FileAllocationEntry.h"
|
|
||||||
#include "RecoverableException.h"
|
#include "RecoverableException.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
@ -83,153 +72,6 @@ HttpServerCommand::~HttpServerCommand()
|
||||||
_e->deleteSocketForReadCheck(_socket, this);
|
_e->deleteSocketForReadCheck(_socket, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PrintSummaryHtml
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
std::ostream& _o;
|
|
||||||
|
|
||||||
public:
|
|
||||||
PrintSummaryHtml(std::ostream& o):_o(o) {}
|
|
||||||
|
|
||||||
void operator()(const SharedHandle<RequestGroup>& rg)
|
|
||||||
{
|
|
||||||
_o << "<div id=\"gid" << rg->getGID() << "\">"
|
|
||||||
<< "[#" << rg->getGID() << "]"
|
|
||||||
<< " FILE:" << "<strong>"
|
|
||||||
<< Util::htmlEscape(rg->getFilePath()) << "</strong>";
|
|
||||||
#ifdef ENABLE_BITTORRENT
|
|
||||||
SharedHandle<BtContext> btContext =
|
|
||||||
dynamic_pointer_cast<BtContext>(rg->getDownloadContext());
|
|
||||||
if(!btContext.isNull()) {
|
|
||||||
_o << "<br />" << " Info Hash:" << btContext->getInfoHashAsString();
|
|
||||||
}
|
|
||||||
#endif // ENABLE_BITTORRENT
|
|
||||||
_o << "<br />";
|
|
||||||
|
|
||||||
TransferStat stat = rg->calculateStat();
|
|
||||||
unsigned int eta = 0;
|
|
||||||
if(rg->getTotalLength() > 0 && stat.getDownloadSpeed() > 0) {
|
|
||||||
eta =
|
|
||||||
(rg->getTotalLength()-rg->getCompletedLength())/stat.getDownloadSpeed();
|
|
||||||
}
|
|
||||||
#ifdef ENABLE_BITTORRENT
|
|
||||||
if(!btContext.isNull() && rg->downloadFinished()) {
|
|
||||||
_o << "SEEDING" << "(" << "ratio:"
|
|
||||||
<< std::fixed << std::setprecision(1)
|
|
||||||
<< ((stat.getAllTimeUploadLength()*10)/rg->getCompletedLength())/10.0
|
|
||||||
<< ") ";
|
|
||||||
}
|
|
||||||
#endif // ENABLE_BITTORRENT
|
|
||||||
_o << Util::abbrevSize(rg->getCompletedLength())
|
|
||||||
<< "B"
|
|
||||||
<< "/"
|
|
||||||
<< Util::abbrevSize(rg->getTotalLength())
|
|
||||||
<< "B";
|
|
||||||
if(rg->getTotalLength() > 0) {
|
|
||||||
_o << "("
|
|
||||||
<< 100*rg->getCompletedLength()/rg->getTotalLength()
|
|
||||||
<< "%)";
|
|
||||||
}
|
|
||||||
_o << " "
|
|
||||||
<< "CN:"
|
|
||||||
<< rg->getNumConnection();
|
|
||||||
if(!rg->downloadFinished()) {
|
|
||||||
_o << " "
|
|
||||||
<< "SPD:"
|
|
||||||
<< std::fixed << std::setprecision(2)
|
|
||||||
<< stat.getDownloadSpeed()/1024.0 << "KiB/s";
|
|
||||||
}
|
|
||||||
if(stat.getSessionUploadLength() > 0) {
|
|
||||||
_o << " "
|
|
||||||
<< "UP:"
|
|
||||||
<< std::fixed << std::setprecision(2)
|
|
||||||
<< stat.getUploadSpeed()/1024.0 << "KiB/s"
|
|
||||||
<< "(" << Util::abbrevSize(stat.getAllTimeUploadLength()) << "B)";
|
|
||||||
}
|
|
||||||
if(eta > 0) {
|
|
||||||
_o << " "
|
|
||||||
<< "ETA:"
|
|
||||||
<< Util::htmlEscape(Util::secfmt(eta));
|
|
||||||
}
|
|
||||||
_o << "</div>"
|
|
||||||
<< "<hr />";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::string createResponse(DownloadEngine* e)
|
|
||||||
{
|
|
||||||
std::ostringstream strm;
|
|
||||||
const std::deque<SharedHandle<RequestGroup> > groups =
|
|
||||||
e->_requestGroupMan->getRequestGroups();
|
|
||||||
std::for_each(groups.begin(), groups.end(), PrintSummaryHtml(strm));
|
|
||||||
|
|
||||||
{
|
|
||||||
SharedHandle<FileAllocationEntry> entry =
|
|
||||||
e->_fileAllocationMan->getPickedEntry();
|
|
||||||
if(!entry.isNull()) {
|
|
||||||
strm << "<div id=\"filealloc\">"
|
|
||||||
<< "[FileAlloc:"
|
|
||||||
<< "#" << entry->getRequestGroup()->getGID() << " "
|
|
||||||
<< Util::abbrevSize(entry->getCurrentLength())
|
|
||||||
<< "B"
|
|
||||||
<< "/"
|
|
||||||
<< Util::abbrevSize(entry->getTotalLength())
|
|
||||||
<< "B"
|
|
||||||
<< "(";
|
|
||||||
if(entry->getTotalLength() > 0) {
|
|
||||||
strm << 100*entry->getCurrentLength()/entry->getTotalLength();
|
|
||||||
} else {
|
|
||||||
strm << "--";
|
|
||||||
}
|
|
||||||
strm << "%)"
|
|
||||||
<< "]";
|
|
||||||
if(e->_fileAllocationMan->hasNext()) {
|
|
||||||
strm << "("
|
|
||||||
<< e->_fileAllocationMan->countEntryInQueue()
|
|
||||||
<< "waiting...)";
|
|
||||||
}
|
|
||||||
strm << "</div><hr />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef ENABLE_MESSAGE_DIGEST
|
|
||||||
{
|
|
||||||
SharedHandle<CheckIntegrityEntry> entry =
|
|
||||||
e->_checkIntegrityMan->getPickedEntry();
|
|
||||||
if(!entry.isNull()) {
|
|
||||||
strm << "<div id=\"hashcheck\">"
|
|
||||||
<< "[HashCheck:"
|
|
||||||
<< "#" << entry->getRequestGroup()->getGID() << " "
|
|
||||||
<< Util::abbrevSize(entry->getCurrentLength())
|
|
||||||
<< "B"
|
|
||||||
<< "/"
|
|
||||||
<< Util::abbrevSize(entry->getTotalLength())
|
|
||||||
<< "B"
|
|
||||||
<< "("
|
|
||||||
<< 100*entry->getCurrentLength()/entry->getTotalLength()
|
|
||||||
<< "%)"
|
|
||||||
<< "]";
|
|
||||||
if(e->_checkIntegrityMan->hasNext()) {
|
|
||||||
strm << "("
|
|
||||||
<< e->_checkIntegrityMan->countEntryInQueue()
|
|
||||||
<< "waiting...)";
|
|
||||||
}
|
|
||||||
strm << "</div><hr />";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // ENABLE_MESSAGE_DIGEST
|
|
||||||
std::string body =
|
|
||||||
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
|
|
||||||
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
|
|
||||||
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">"
|
|
||||||
"<head>"
|
|
||||||
"<meta http-equiv=\"refresh\" content=\"1\" />"
|
|
||||||
"<title>aria2</title>"
|
|
||||||
"</head>"
|
|
||||||
"<body><h1>aria2 - Download Progress</h1>"+strm.str()+"</body>"
|
|
||||||
"</html>";
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HttpServerCommand::execute()
|
bool HttpServerCommand::execute()
|
||||||
{
|
{
|
||||||
if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) {
|
if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) {
|
||||||
|
|
|
@ -69,11 +69,11 @@ bool HttpServerResponseCommand::execute()
|
||||||
_httpServer->sendResponse();
|
_httpServer->sendResponse();
|
||||||
if(_httpServer->sendBufferIsEmpty()) {
|
if(_httpServer->sendBufferIsEmpty()) {
|
||||||
logger->info("CUID#%d - HttpServer: all response transmitted.", cuid);
|
logger->info("CUID#%d - HttpServer: all response transmitted.", cuid);
|
||||||
// if(_httpServer->supportsPersistentConnection()) {
|
if(_httpServer->supportsPersistentConnection()) {
|
||||||
// logger->info("CUID#%d - Persist connection.", cuid);
|
logger->info("CUID#%d - Persist connection.", cuid);
|
||||||
// _e->commands.push_back
|
_e->commands.push_back
|
||||||
// (new HttpServerCommand(cuid, _httpServer, _e, _socket));
|
(new HttpServerCommand(cuid, _httpServer, _e, _socket));
|
||||||
// }
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if(_timeout.elapsed(10)) {
|
if(_timeout.elapsed(10)) {
|
||||||
|
|
|
@ -200,10 +200,6 @@ SRCS = Socket.h\
|
||||||
SelectEventPoll.cc SelectEventPoll.h\
|
SelectEventPoll.cc SelectEventPoll.h\
|
||||||
SequentialPicker.h\
|
SequentialPicker.h\
|
||||||
SequentialDispatcherCommand.h\
|
SequentialDispatcherCommand.h\
|
||||||
HttpListenCommand.cc HttpListenCommand.h\
|
|
||||||
HttpServerCommand.cc HttpServerCommand.h\
|
|
||||||
HttpServerResponseCommand.cc HttpServerResponseCommand.h\
|
|
||||||
HttpServer.cc HttpServer.h\
|
|
||||||
PieceSelector.h\
|
PieceSelector.h\
|
||||||
LongestSequencePieceSelector.cc LongestSequencePieceSelector.h\
|
LongestSequencePieceSelector.cc LongestSequencePieceSelector.h\
|
||||||
bitfield.h\
|
bitfield.h\
|
||||||
|
@ -220,7 +216,11 @@ SRCS += XmlRpcRequestParserController.cc XmlRpcRequestParserController.h\
|
||||||
HttpServerBodyCommand.cc HttpServerBodyCommand.h\
|
HttpServerBodyCommand.cc HttpServerBodyCommand.h\
|
||||||
XmlRpcMethod.cc XmlRpcMethod.h\
|
XmlRpcMethod.cc XmlRpcMethod.h\
|
||||||
XmlRpcMethodImpl.cc XmlRpcMethodImpl.h\
|
XmlRpcMethodImpl.cc XmlRpcMethodImpl.h\
|
||||||
XmlRpcMethodFactory.cc XmlRpcMethodFactory.h
|
XmlRpcMethodFactory.cc XmlRpcMethodFactory.h\
|
||||||
|
HttpListenCommand.cc HttpListenCommand.h\
|
||||||
|
HttpServerCommand.cc HttpServerCommand.h\
|
||||||
|
HttpServerResponseCommand.cc HttpServerResponseCommand.h\
|
||||||
|
HttpServer.cc HttpServer.h
|
||||||
endif # ENABLE_XML_RPC
|
endif # ENABLE_XML_RPC
|
||||||
|
|
||||||
if HAVE_LIBXML2
|
if HAVE_LIBXML2
|
||||||
|
|
|
@ -45,7 +45,11 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
||||||
@ENABLE_XML_RPC_TRUE@ HttpServerBodyCommand.cc HttpServerBodyCommand.h\
|
@ENABLE_XML_RPC_TRUE@ HttpServerBodyCommand.cc HttpServerBodyCommand.h\
|
||||||
@ENABLE_XML_RPC_TRUE@ XmlRpcMethod.cc XmlRpcMethod.h\
|
@ENABLE_XML_RPC_TRUE@ XmlRpcMethod.cc XmlRpcMethod.h\
|
||||||
@ENABLE_XML_RPC_TRUE@ XmlRpcMethodImpl.cc XmlRpcMethodImpl.h\
|
@ENABLE_XML_RPC_TRUE@ XmlRpcMethodImpl.cc XmlRpcMethodImpl.h\
|
||||||
@ENABLE_XML_RPC_TRUE@ XmlRpcMethodFactory.cc XmlRpcMethodFactory.h
|
@ENABLE_XML_RPC_TRUE@ XmlRpcMethodFactory.cc XmlRpcMethodFactory.h\
|
||||||
|
@ENABLE_XML_RPC_TRUE@ HttpListenCommand.cc HttpListenCommand.h\
|
||||||
|
@ENABLE_XML_RPC_TRUE@ HttpServerCommand.cc HttpServerCommand.h\
|
||||||
|
@ENABLE_XML_RPC_TRUE@ HttpServerResponseCommand.cc HttpServerResponseCommand.h\
|
||||||
|
@ENABLE_XML_RPC_TRUE@ HttpServer.cc HttpServer.h
|
||||||
|
|
||||||
@HAVE_LIBXML2_TRUE@am__append_2 = Xml2XmlRpcRequestProcessor.cc Xml2XmlRpcRequestProcessor.h
|
@HAVE_LIBXML2_TRUE@am__append_2 = Xml2XmlRpcRequestProcessor.cc Xml2XmlRpcRequestProcessor.h
|
||||||
@HAVE_LIBEXPAT_TRUE@am__append_3 = ExpatXmlRpcRequestProcessor.cc ExpatXmlRpcRequestProcessor.h
|
@HAVE_LIBEXPAT_TRUE@am__append_3 = ExpatXmlRpcRequestProcessor.cc ExpatXmlRpcRequestProcessor.h
|
||||||
|
@ -418,9 +422,6 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
||||||
OptionHandlerException.h bencode.cc bencode.h URIResult.cc \
|
OptionHandlerException.h bencode.cc bencode.h URIResult.cc \
|
||||||
URIResult.h EventPoll.h SelectEventPoll.cc SelectEventPoll.h \
|
URIResult.h EventPoll.h SelectEventPoll.cc SelectEventPoll.h \
|
||||||
SequentialPicker.h SequentialDispatcherCommand.h \
|
SequentialPicker.h SequentialDispatcherCommand.h \
|
||||||
HttpListenCommand.cc HttpListenCommand.h HttpServerCommand.cc \
|
|
||||||
HttpServerCommand.h HttpServerResponseCommand.cc \
|
|
||||||
HttpServerResponseCommand.h HttpServer.cc HttpServer.h \
|
|
||||||
PieceSelector.h LongestSequencePieceSelector.cc \
|
PieceSelector.h LongestSequencePieceSelector.cc \
|
||||||
LongestSequencePieceSelector.h bitfield.h BDE.cc BDE.h \
|
LongestSequencePieceSelector.h bitfield.h BDE.cc BDE.h \
|
||||||
XmlRpcRequestParserController.cc \
|
XmlRpcRequestParserController.cc \
|
||||||
|
@ -432,7 +433,10 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
||||||
XmlRpcRequestProcessor.h HttpServerBodyCommand.cc \
|
XmlRpcRequestProcessor.h HttpServerBodyCommand.cc \
|
||||||
HttpServerBodyCommand.h XmlRpcMethod.cc XmlRpcMethod.h \
|
HttpServerBodyCommand.h XmlRpcMethod.cc XmlRpcMethod.h \
|
||||||
XmlRpcMethodImpl.cc XmlRpcMethodImpl.h XmlRpcMethodFactory.cc \
|
XmlRpcMethodImpl.cc XmlRpcMethodImpl.h XmlRpcMethodFactory.cc \
|
||||||
XmlRpcMethodFactory.h Xml2XmlRpcRequestProcessor.cc \
|
XmlRpcMethodFactory.h HttpListenCommand.cc HttpListenCommand.h \
|
||||||
|
HttpServerCommand.cc HttpServerCommand.h \
|
||||||
|
HttpServerResponseCommand.cc HttpServerResponseCommand.h \
|
||||||
|
HttpServer.cc HttpServer.h Xml2XmlRpcRequestProcessor.cc \
|
||||||
Xml2XmlRpcRequestProcessor.h ExpatXmlRpcRequestProcessor.cc \
|
Xml2XmlRpcRequestProcessor.h ExpatXmlRpcRequestProcessor.cc \
|
||||||
ExpatXmlRpcRequestProcessor.h FallocFileAllocationIterator.cc \
|
ExpatXmlRpcRequestProcessor.h FallocFileAllocationIterator.cc \
|
||||||
FallocFileAllocationIterator.h EpollEventPoll.cc \
|
FallocFileAllocationIterator.h EpollEventPoll.cc \
|
||||||
|
@ -596,7 +600,11 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
||||||
@ENABLE_XML_RPC_TRUE@ HttpServerBodyCommand.$(OBJEXT) \
|
@ENABLE_XML_RPC_TRUE@ HttpServerBodyCommand.$(OBJEXT) \
|
||||||
@ENABLE_XML_RPC_TRUE@ XmlRpcMethod.$(OBJEXT) \
|
@ENABLE_XML_RPC_TRUE@ XmlRpcMethod.$(OBJEXT) \
|
||||||
@ENABLE_XML_RPC_TRUE@ XmlRpcMethodImpl.$(OBJEXT) \
|
@ENABLE_XML_RPC_TRUE@ XmlRpcMethodImpl.$(OBJEXT) \
|
||||||
@ENABLE_XML_RPC_TRUE@ XmlRpcMethodFactory.$(OBJEXT)
|
@ENABLE_XML_RPC_TRUE@ XmlRpcMethodFactory.$(OBJEXT) \
|
||||||
|
@ENABLE_XML_RPC_TRUE@ HttpListenCommand.$(OBJEXT) \
|
||||||
|
@ENABLE_XML_RPC_TRUE@ HttpServerCommand.$(OBJEXT) \
|
||||||
|
@ENABLE_XML_RPC_TRUE@ HttpServerResponseCommand.$(OBJEXT) \
|
||||||
|
@ENABLE_XML_RPC_TRUE@ HttpServer.$(OBJEXT)
|
||||||
@HAVE_LIBXML2_TRUE@am__objects_2 = \
|
@HAVE_LIBXML2_TRUE@am__objects_2 = \
|
||||||
@HAVE_LIBXML2_TRUE@ Xml2XmlRpcRequestProcessor.$(OBJEXT)
|
@HAVE_LIBXML2_TRUE@ Xml2XmlRpcRequestProcessor.$(OBJEXT)
|
||||||
@HAVE_LIBEXPAT_TRUE@am__objects_3 = \
|
@HAVE_LIBEXPAT_TRUE@am__objects_3 = \
|
||||||
|
@ -835,9 +843,7 @@ am__objects_26 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
||||||
NsCookieParser.$(OBJEXT) CookieStorage.$(OBJEXT) \
|
NsCookieParser.$(OBJEXT) CookieStorage.$(OBJEXT) \
|
||||||
SocketBuffer.$(OBJEXT) OptionHandlerException.$(OBJEXT) \
|
SocketBuffer.$(OBJEXT) OptionHandlerException.$(OBJEXT) \
|
||||||
bencode.$(OBJEXT) URIResult.$(OBJEXT) \
|
bencode.$(OBJEXT) URIResult.$(OBJEXT) \
|
||||||
SelectEventPoll.$(OBJEXT) HttpListenCommand.$(OBJEXT) \
|
SelectEventPoll.$(OBJEXT) \
|
||||||
HttpServerCommand.$(OBJEXT) \
|
|
||||||
HttpServerResponseCommand.$(OBJEXT) HttpServer.$(OBJEXT) \
|
|
||||||
LongestSequencePieceSelector.$(OBJEXT) BDE.$(OBJEXT) \
|
LongestSequencePieceSelector.$(OBJEXT) BDE.$(OBJEXT) \
|
||||||
$(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
$(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||||
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
|
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
|
||||||
|
@ -1172,9 +1178,6 @@ SRCS = Socket.h SocketCore.cc SocketCore.h BinaryStream.h Command.cc \
|
||||||
OptionHandlerException.h bencode.cc bencode.h URIResult.cc \
|
OptionHandlerException.h bencode.cc bencode.h URIResult.cc \
|
||||||
URIResult.h EventPoll.h SelectEventPoll.cc SelectEventPoll.h \
|
URIResult.h EventPoll.h SelectEventPoll.cc SelectEventPoll.h \
|
||||||
SequentialPicker.h SequentialDispatcherCommand.h \
|
SequentialPicker.h SequentialDispatcherCommand.h \
|
||||||
HttpListenCommand.cc HttpListenCommand.h HttpServerCommand.cc \
|
|
||||||
HttpServerCommand.h HttpServerResponseCommand.cc \
|
|
||||||
HttpServerResponseCommand.h HttpServer.cc HttpServer.h \
|
|
||||||
PieceSelector.h LongestSequencePieceSelector.cc \
|
PieceSelector.h LongestSequencePieceSelector.cc \
|
||||||
LongestSequencePieceSelector.h bitfield.h BDE.cc BDE.h \
|
LongestSequencePieceSelector.h bitfield.h BDE.cc BDE.h \
|
||||||
$(am__append_1) $(am__append_2) $(am__append_3) \
|
$(am__append_1) $(am__append_2) $(am__append_3) \
|
||||||
|
|
|
@ -168,15 +168,17 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_DIRECT_IO
|
#endif // ENABLE_DIRECT_IO
|
||||||
|
#ifdef ENABLE_XML_RPC
|
||||||
{
|
{
|
||||||
SharedHandle<OptionHandler> op(new BooleanOptionHandler
|
SharedHandle<OptionHandler> op(new BooleanOptionHandler
|
||||||
(PREF_ENABLE_HTTP_SERVER,
|
(PREF_ENABLE_XML_RPC,
|
||||||
TEXT_ENABLE_HTTP_SERVER,
|
TEXT_ENABLE_XML_RPC,
|
||||||
V_FALSE,
|
V_FALSE,
|
||||||
OptionHandler::OPT_ARG));
|
OptionHandler::OPT_ARG));
|
||||||
op->addTag(TAG_EXPERIMENTAL);
|
op->addTag(TAG_ADVANCED);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
|
#endif // ENABLE_XML_RPC
|
||||||
{
|
{
|
||||||
std::string params[] = {
|
std::string params[] = {
|
||||||
#ifdef HAVE_EPOLL
|
#ifdef HAVE_EPOLL
|
||||||
|
@ -220,15 +222,6 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
||||||
op->addTag(TAG_BASIC);
|
op->addTag(TAG_BASIC);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
{
|
|
||||||
SharedHandle<OptionHandler> op(new NumberOptionHandler
|
|
||||||
(PREF_HTTP_SERVER_LISTEN_PORT,
|
|
||||||
TEXT_HTTP_SERVER_LISTEN_PORT,
|
|
||||||
"6800",
|
|
||||||
1024, UINT16_MAX));
|
|
||||||
op->addTag(TAG_EXPERIMENTAL);
|
|
||||||
handlers.push_back(op);
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
SharedHandle<OptionHandler> op(new DefaultOptionHandler
|
SharedHandle<OptionHandler> op(new DefaultOptionHandler
|
||||||
(PREF_INPUT_FILE,
|
(PREF_INPUT_FILE,
|
||||||
|
@ -361,6 +354,17 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
||||||
op->addTag(TAG_ADVANCED);
|
op->addTag(TAG_ADVANCED);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
|
#ifdef ENABLE_XML_RPC
|
||||||
|
{
|
||||||
|
SharedHandle<OptionHandler> op(new NumberOptionHandler
|
||||||
|
(PREF_XML_RPC_LISTEN_PORT,
|
||||||
|
TEXT_XML_RPC_LISTEN_PORT,
|
||||||
|
"6800",
|
||||||
|
1024, UINT16_MAX));
|
||||||
|
op->addTag(TAG_ADVANCED);
|
||||||
|
handlers.push_back(op);
|
||||||
|
}
|
||||||
|
#endif // ENABLE_XML_RPC
|
||||||
// HTTP/FTP options
|
// HTTP/FTP options
|
||||||
{
|
{
|
||||||
SharedHandle<OptionHandler> op(new NumberOptionHandler
|
SharedHandle<OptionHandler> op(new NumberOptionHandler
|
||||||
|
|
|
@ -83,9 +83,11 @@ RequestGroupMan::RequestGroupMan(const RequestGroups& requestGroups,
|
||||||
|
|
||||||
bool RequestGroupMan::downloadFinished()
|
bool RequestGroupMan::downloadFinished()
|
||||||
{
|
{
|
||||||
if(_option->getAsBool(PREF_ENABLE_HTTP_SERVER)) {
|
#ifdef ENABLE_XML_RPC
|
||||||
|
if(_option->getAsBool(PREF_ENABLE_XML_RPC)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif // ENABLE_XML_RPC
|
||||||
if(!_reservedGroups.empty()) {
|
if(!_reservedGroups.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ DownloadResult::RESULT main(int argc, char* argv[])
|
||||||
|
|
||||||
if(
|
if(
|
||||||
#ifdef ENABLE_XML_RPC
|
#ifdef ENABLE_XML_RPC
|
||||||
!op->getAsBool(PREF_ENABLE_HTTP_SERVER) &&
|
!op->getAsBool(PREF_ENABLE_XML_RPC) &&
|
||||||
#endif // ENABLE_XML_RPC
|
#endif // ENABLE_XML_RPC
|
||||||
requestGroups.empty()) {
|
requestGroups.empty()) {
|
||||||
std::cout << MSG_NO_FILES_TO_DOWNLOAD << std::endl;
|
std::cout << MSG_NO_FILES_TO_DOWNLOAD << std::endl;
|
||||||
|
|
|
@ -174,7 +174,7 @@ void option_processing(Option& op, std::deque<std::string>& uris,
|
||||||
}
|
}
|
||||||
if(
|
if(
|
||||||
#ifdef ENABLE_XML_RPC
|
#ifdef ENABLE_XML_RPC
|
||||||
!op.getAsBool(PREF_ENABLE_HTTP_SERVER) &&
|
!op.getAsBool(PREF_ENABLE_XML_RPC) &&
|
||||||
#endif // ENABLE_XML_RPC
|
#endif // ENABLE_XML_RPC
|
||||||
#ifdef ENABLE_BITTORRENT
|
#ifdef ENABLE_BITTORRENT
|
||||||
op.blank(PREF_TORRENT_FILE) &&
|
op.blank(PREF_TORRENT_FILE) &&
|
||||||
|
|
|
@ -154,9 +154,9 @@ const std::string PREF_EVENT_POLL("event-poll");
|
||||||
const std::string V_EPOLL("epoll");
|
const std::string V_EPOLL("epoll");
|
||||||
const std::string V_SELECT("select");
|
const std::string V_SELECT("select");
|
||||||
// value: 1*digit
|
// value: 1*digit
|
||||||
const std::string PREF_HTTP_SERVER_LISTEN_PORT("http-server-listen-port");
|
const std::string PREF_XML_RPC_LISTEN_PORT("xml-rpc-listen-port");
|
||||||
// value: true | false
|
// value: true | false
|
||||||
const std::string PREF_ENABLE_HTTP_SERVER("enable-http-server");
|
const std::string PREF_ENABLE_XML_RPC("enable-xml-rpc");
|
||||||
// value: true | false
|
// value: true | false
|
||||||
const std::string PREF_RESET_URI("reset-uri");
|
const std::string PREF_RESET_URI("reset-uri");
|
||||||
// value: true | false
|
// value: true | false
|
||||||
|
|
|
@ -158,9 +158,9 @@ extern const std::string PREF_EVENT_POLL;
|
||||||
extern const std::string V_EPOLL;
|
extern const std::string V_EPOLL;
|
||||||
extern const std::string V_SELECT;
|
extern const std::string V_SELECT;
|
||||||
// value: 1*digit
|
// value: 1*digit
|
||||||
extern const std::string PREF_HTTP_SERVER_LISTEN_PORT;
|
extern const std::string PREF_XML_RPC_LISTEN_PORT;
|
||||||
// value: true | false
|
// value: true | false
|
||||||
extern const std::string PREF_ENABLE_HTTP_SERVER;
|
extern const std::string PREF_ENABLE_XML_RPC;
|
||||||
// value: true | false
|
// value: true | false
|
||||||
extern const std::string PREF_RESET_URI;
|
extern const std::string PREF_RESET_URI;
|
||||||
// value: true | false
|
// value: true | false
|
||||||
|
|
|
@ -478,17 +478,13 @@ _(" --use-head[=true|false] Use HEAD method for the first request to the HT
|
||||||
" server.")
|
" server.")
|
||||||
#define TEXT_EVENT_POLL \
|
#define TEXT_EVENT_POLL \
|
||||||
_(" --event-poll=POLL Specify the method for polling events.")
|
_(" --event-poll=POLL Specify the method for polling events.")
|
||||||
#define TEXT_HTTP_SERVER_LISTEN_PORT \
|
#define TEXT_XML_RPC_LISTEN_PORT \
|
||||||
" --http-server-listen-port=PORT Specify a port number for the built-in HTTP\n"\
|
_(" --xml-rpc-listen-port=PORT Specify a port number for XML-RPC server to listen\n"\
|
||||||
" Server to listen to."
|
" to.")
|
||||||
// Excluded from translation candidiates because it is subject to change.
|
// Excluded from translation candidiates because it is subject to change.
|
||||||
#define TEXT_ENABLE_HTTP_SERVER \
|
#define TEXT_ENABLE_XML_RPC \
|
||||||
" --enable-http-server[=true|false] Enable the built-in HTTP server. Currently,\n"\
|
_(" --enable-xml-rpc[=true|false] Enable XML-RPC server.\n"\
|
||||||
" this is the experimental feature and it just\n"\
|
" See also --xml-rpc-listen-port option.")
|
||||||
" provides the current download progress. Use your\n"\
|
|
||||||
" web browser(console-based ones, such as elinks,\n"\
|
|
||||||
" w3m, are recommended) to connect the server and\n"\
|
|
||||||
" see what's what."
|
|
||||||
#define TEXT_BT_EXTERNAL_IP \
|
#define TEXT_BT_EXTERNAL_IP \
|
||||||
_(" --bt-external-ip=IPADDRESS Specify the external IP address to report to a\n"\
|
_(" --bt-external-ip=IPADDRESS Specify the external IP address to report to a\n"\
|
||||||
" BitTorrent tracker. Although this function is\n"\
|
" BitTorrent tracker. Although this function is\n"\
|
||||||
|
|
Loading…
Reference in New Issue