AbstractCommand.cc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2006 Tatsuhiro Tsujikawa
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of portions of this program with the
  23. * OpenSSL library under certain conditions as described in each
  24. * individual source file, and distribute linked combinations
  25. * including the two.
  26. * You must obey the GNU General Public License in all respects
  27. * for all of the code used other than OpenSSL. If you modify
  28. * file(s) with this exception, you may extend this exception to your
  29. * version of the file(s), but you are not obligated to do so. If you
  30. * do not wish to do so, delete this exception statement from your
  31. * version. If you delete this exception statement from all source
  32. * files in the program, then also delete it here.
  33. */
  34. /* copyright --> */
  35. #include "AbstractCommand.h"
  36. #include <algorithm>
  37. #include "Request.h"
  38. #include "DownloadEngine.h"
  39. #include "Option.h"
  40. #include "PeerStat.h"
  41. #include "SegmentMan.h"
  42. #include "Logger.h"
  43. #include "Segment.h"
  44. #include "DlAbortEx.h"
  45. #include "DlRetryEx.h"
  46. #include "DownloadFailureException.h"
  47. #include "CreateRequestCommand.h"
  48. #include "InitiateConnectionCommandFactory.h"
  49. #include "SleepCommand.h"
  50. #ifdef ENABLE_ASYNC_DNS
  51. #include "AsyncNameResolver.h"
  52. #endif // ENABLE_ASYNC_DNS
  53. #include "StreamCheckIntegrityEntry.h"
  54. #include "PieceStorage.h"
  55. #include "Socket.h"
  56. #include "message.h"
  57. #include "prefs.h"
  58. #include "StringFormat.h"
  59. #include "ServerStat.h"
  60. #include "RequestGroupMan.h"
  61. #include "A2STR.h"
  62. #include "Util.h"
  63. #include "LogFactory.h"
  64. #include "DownloadContext.h"
  65. namespace aria2 {
  66. AbstractCommand::AbstractCommand(int32_t cuid,
  67. const SharedHandle<Request>& req,
  68. const SharedHandle<FileEntry>& fileEntry,
  69. RequestGroup* requestGroup,
  70. DownloadEngine* e,
  71. const SocketHandle& s):
  72. Command(cuid), _requestGroup(requestGroup),
  73. req(req), _fileEntry(fileEntry), e(e), socket(s),
  74. checkSocketIsReadable(false), checkSocketIsWritable(false),
  75. nameResolverCheck(false)
  76. {
  77. if(!socket.isNull() && socket->isOpen()) {
  78. setReadCheckSocket(socket);
  79. }
  80. timeout = _requestGroup->getTimeout();
  81. _requestGroup->increaseStreamConnection();
  82. _requestGroup->increaseNumCommand();
  83. }
  84. AbstractCommand::~AbstractCommand() {
  85. disableReadCheckSocket();
  86. disableWriteCheckSocket();
  87. #ifdef ENABLE_ASYNC_DNS
  88. disableNameResolverCheck(_asyncNameResolver);
  89. #endif // ENABLE_ASYNC_DNS
  90. _requestGroup->decreaseNumCommand();
  91. _requestGroup->decreaseStreamConnection();
  92. }
  93. bool AbstractCommand::execute() {
  94. logger->debug("CUID#%d - socket: read:%d, write:%d, hup:%d, err:%d",
  95. cuid, _readEvent, _writeEvent, _hupEvent, _errorEvent);
  96. try {
  97. if(_requestGroup->downloadFinished() || _requestGroup->isHaltRequested()) {
  98. //logger->debug("CUID#%d - finished.", cuid);
  99. return true;
  100. }
  101. // TODO1.5 it is not needed to check other PeerStats every time.
  102. // Find faster Request when this is the only active Request
  103. if(!req.isNull() && _requestGroup->getNumStreamConnection() == 1 &&
  104. _fileEntry->countPooledRequest() > 0) {
  105. SharedHandle<Request> fasterRequest = _fileEntry->findFasterRequest(req);
  106. if(!fasterRequest.isNull()) {
  107. logger->info("CUID#%d - Use faster Request hostname=%s, port=%u",
  108. cuid,
  109. fasterRequest->getHost().c_str(),
  110. fasterRequest->getPort());
  111. // Cancel current Request object and use faster one.
  112. _fileEntry->removeRequest(req);
  113. Command* command =
  114. InitiateConnectionCommandFactory::createInitiateConnectionCommand
  115. (cuid, fasterRequest, _fileEntry, _requestGroup, e);
  116. e->setNoWait(true);
  117. e->commands.push_back(command);
  118. return true;
  119. }
  120. }
  121. if((checkSocketIsReadable && _readEvent) ||
  122. (checkSocketIsWritable && _writeEvent) ||
  123. _hupEvent ||
  124. #ifdef ENABLE_ASYNC_DNS
  125. (nameResolverCheck && nameResolveFinished()) ||
  126. #endif // ENABLE_ASYNC_DNS
  127. (!checkSocketIsReadable && !checkSocketIsWritable && !nameResolverCheck)) {
  128. checkPoint.reset();
  129. if(!_requestGroup->getPieceStorage().isNull()) {
  130. _segments.clear();
  131. _requestGroup->getSegmentMan()->getInFlightSegment(_segments, cuid);
  132. if(req.isNull() || req->getMaxPipelinedRequest() == 1 ||
  133. _requestGroup->getDownloadContext()->getFileEntries().size() == 1) {
  134. if(_segments.empty()) {
  135. SharedHandle<Segment> segment =
  136. _requestGroup->getSegmentMan()->getSegment(cuid);
  137. if(!segment.isNull()) {
  138. _segments.push_back(segment);
  139. }
  140. }
  141. if(_segments.empty()) {
  142. // TODO socket could be pooled here if pipelining is enabled...
  143. logger->info(MSG_NO_SEGMENT_AVAILABLE, cuid);
  144. // When all segments are ignored in SegmentMan, there are
  145. // no URIs available, so don't retry.
  146. if(_requestGroup->getSegmentMan()->allSegmentsIgnored()) {
  147. return true;
  148. } else {
  149. return prepareForRetry(1);
  150. }
  151. }
  152. } else {
  153. size_t maxSegments = req->getMaxPipelinedRequest();
  154. if(_segments.size() < maxSegments) {
  155. _requestGroup->getSegmentMan()->getSegment
  156. (_segments, cuid, _fileEntry, maxSegments);
  157. }
  158. if(_segments.empty()) {
  159. return prepareForRetry(0);
  160. }
  161. }
  162. }
  163. return executeInternal();
  164. } else if(_errorEvent) {
  165. throw DL_RETRY_EX
  166. (StringFormat(MSG_NETWORK_PROBLEM,
  167. socket->getSocketError().c_str()).str());
  168. } else {
  169. if(checkPoint.elapsed(timeout)) {
  170. // timeout triggers ServerStat error state.
  171. SharedHandle<ServerStat> ss =
  172. e->_requestGroupMan->getOrCreateServerStat(req->getHost(),
  173. req->getProtocol());
  174. ss->setError();
  175. throw DL_RETRY_EX2(EX_TIME_OUT, downloadresultcode::TIME_OUT);
  176. }
  177. e->commands.push_back(this);
  178. return false;
  179. }
  180. } catch(DlAbortEx& err) {
  181. if(req.isNull()) {
  182. logger->debug(EX_EXCEPTION_CAUGHT, err);
  183. } else {
  184. logger->error(MSG_DOWNLOAD_ABORTED,
  185. DL_ABORT_EX2(StringFormat
  186. ("URI=%s", req->getCurrentUrl().c_str()).str(),err),
  187. cuid, req->getUrl().c_str());
  188. _fileEntry->addURIResult(req->getUrl(), err.getCode());
  189. _requestGroup->setLastUriResult(req->getUrl(), err.getCode());
  190. }
  191. onAbort();
  192. tryReserved();
  193. return true;
  194. } catch(DlRetryEx& err) {
  195. assert(!req.isNull());
  196. logger->info(MSG_RESTARTING_DOWNLOAD,
  197. DL_RETRY_EX2(StringFormat
  198. ("URI=%s", req->getCurrentUrl().c_str()).str(),err),
  199. cuid, req->getUrl().c_str());
  200. req->addTryCount();
  201. req->resetRedirectCount();
  202. const unsigned int maxTries = getOption()->getAsInt(PREF_MAX_TRIES);
  203. bool isAbort = maxTries != 0 && req->getTryCount() >= maxTries;
  204. if(isAbort) {
  205. onAbort();
  206. logger->info(MSG_MAX_TRY, cuid, req->getTryCount());
  207. logger->error(MSG_DOWNLOAD_ABORTED, err, cuid, req->getUrl().c_str());
  208. _fileEntry->addURIResult(req->getUrl(), err.getCode());
  209. _requestGroup->setLastUriResult(req->getUrl(), err.getCode());
  210. tryReserved();
  211. return true;
  212. } else {
  213. return prepareForRetry(getOption()->getAsInt(PREF_RETRY_WAIT));
  214. }
  215. } catch(DownloadFailureException& err) {
  216. logger->error(EX_EXCEPTION_CAUGHT, err);
  217. if(!req.isNull()) {
  218. _fileEntry->addURIResult(req->getUrl(), err.getCode());
  219. _requestGroup->setLastUriResult(req->getUrl(), err.getCode());
  220. }
  221. _requestGroup->setHaltRequested(true);
  222. return true;
  223. }
  224. }
  225. void AbstractCommand::tryReserved() {
  226. if(_requestGroup->getDownloadContext()->getFileEntries().size() == 1) {
  227. const SharedHandle<FileEntry>& entry =
  228. _requestGroup->getDownloadContext()->getFirstFileEntry();
  229. // Don't create new command if currently file length is unknown
  230. // and there are no URI left. Because file length is unknown, we
  231. // can assume that there are no in-flight request object.
  232. if(entry->getLength() == 0 && entry->getRemainingUris().empty()) {
  233. return;
  234. }
  235. }
  236. Commands commands;
  237. _requestGroup->createNextCommand(commands, e, 1);
  238. e->setNoWait(true);
  239. e->addCommand(commands);
  240. }
  241. bool AbstractCommand::prepareForRetry(time_t wait) {
  242. if(!_requestGroup->getPieceStorage().isNull()) {
  243. _requestGroup->getSegmentMan()->cancelSegment(cuid);
  244. }
  245. if(!req.isNull()) {
  246. _fileEntry->poolRequest(req);
  247. logger->debug("CUID#%d - Pooling request URI=%s",
  248. cuid, req->getUrl().c_str());
  249. if(!_requestGroup->getSegmentMan().isNull()) {
  250. _requestGroup->getSegmentMan()->recognizeSegmentFor(_fileEntry);
  251. }
  252. }
  253. Command* command = new CreateRequestCommand(cuid, _requestGroup, e);
  254. if(wait == 0) {
  255. e->setNoWait(true);
  256. e->commands.push_back(command);
  257. } else {
  258. SleepCommand* scom = new SleepCommand(cuid, e, _requestGroup,
  259. command, wait);
  260. e->commands.push_back(scom);
  261. }
  262. return true;
  263. }
  264. void AbstractCommand::onAbort() {
  265. if(!req.isNull()) {
  266. logger->debug(req->getCurrentUrl().c_str());
  267. // TODO This might be a problem if the failure is caused by proxy.
  268. e->_requestGroupMan->getOrCreateServerStat(req->getHost(),
  269. req->getProtocol())->setError();
  270. _fileEntry->removeIdenticalURI(req->getUrl());
  271. _fileEntry->removeRequest(req);
  272. }
  273. logger->debug(MSG_UNREGISTER_CUID, cuid);
  274. //_segmentMan->unregisterId(cuid);
  275. if(!_requestGroup->getPieceStorage().isNull()) {
  276. _requestGroup->getSegmentMan()->cancelSegment(cuid);
  277. }
  278. }
  279. void AbstractCommand::disableReadCheckSocket() {
  280. if(checkSocketIsReadable) {
  281. e->deleteSocketForReadCheck(readCheckTarget, this);
  282. checkSocketIsReadable = false;
  283. readCheckTarget = SocketHandle();
  284. }
  285. }
  286. void AbstractCommand::setReadCheckSocket(const SocketHandle& socket) {
  287. if(!socket->isOpen()) {
  288. disableReadCheckSocket();
  289. } else {
  290. if(checkSocketIsReadable) {
  291. if(readCheckTarget != socket) {
  292. e->deleteSocketForReadCheck(readCheckTarget, this);
  293. e->addSocketForReadCheck(socket, this);
  294. readCheckTarget = socket;
  295. }
  296. } else {
  297. e->addSocketForReadCheck(socket, this);
  298. checkSocketIsReadable = true;
  299. readCheckTarget = socket;
  300. }
  301. }
  302. }
  303. void AbstractCommand::setReadCheckSocketIf
  304. (const SharedHandle<SocketCore>& socket, bool pred)
  305. {
  306. if(pred) {
  307. setReadCheckSocket(socket);
  308. } else {
  309. disableReadCheckSocket();
  310. }
  311. }
  312. void AbstractCommand::disableWriteCheckSocket() {
  313. if(checkSocketIsWritable) {
  314. e->deleteSocketForWriteCheck(writeCheckTarget, this);
  315. checkSocketIsWritable = false;
  316. writeCheckTarget = SocketHandle();
  317. }
  318. }
  319. void AbstractCommand::setWriteCheckSocket(const SocketHandle& socket) {
  320. if(!socket->isOpen()) {
  321. disableWriteCheckSocket();
  322. } else {
  323. if(checkSocketIsWritable) {
  324. if(writeCheckTarget != socket) {
  325. e->deleteSocketForWriteCheck(writeCheckTarget, this);
  326. e->addSocketForWriteCheck(socket, this);
  327. writeCheckTarget = socket;
  328. }
  329. } else {
  330. e->addSocketForWriteCheck(socket, this);
  331. checkSocketIsWritable = true;
  332. writeCheckTarget = socket;
  333. }
  334. }
  335. }
  336. void AbstractCommand::setWriteCheckSocketIf
  337. (const SharedHandle<SocketCore>& socket, bool pred)
  338. {
  339. if(pred) {
  340. setWriteCheckSocket(socket);
  341. } else {
  342. disableWriteCheckSocket();
  343. }
  344. }
  345. static const std::string& getProxyStringFor(const std::string& proxyPref,
  346. const SharedHandle<Option>& option)
  347. {
  348. if(option->defined(proxyPref)) {
  349. return option->get(proxyPref);
  350. } else {
  351. return option->get(PREF_ALL_PROXY);
  352. }
  353. }
  354. static bool isProxyUsed(const std::string& proxyPref,
  355. const SharedHandle<Option>& option)
  356. {
  357. std::string proxy = getProxyStringFor(proxyPref, option);
  358. if(proxy.empty()) {
  359. return false;
  360. } else {
  361. return Request().setUrl(proxy);
  362. }
  363. }
  364. static bool isProxyRequest(const std::string& protocol,
  365. const SharedHandle<Option>& option)
  366. {
  367. return
  368. (protocol == Request::PROTO_HTTP && isProxyUsed(PREF_HTTP_PROXY, option)) ||
  369. (protocol == Request::PROTO_HTTPS && isProxyUsed(PREF_HTTPS_PROXY,option))||
  370. (protocol == Request::PROTO_FTP && isProxyUsed(PREF_FTP_PROXY, option));
  371. }
  372. class DomainMatch {
  373. private:
  374. std::string _hostname;
  375. public:
  376. DomainMatch(const std::string& hostname):_hostname(hostname) {}
  377. bool operator()(const std::string& domain) const
  378. {
  379. if(Util::startsWith(domain, ".")) {
  380. return Util::endsWith(_hostname, domain);
  381. } else {
  382. return Util::endsWith(_hostname, "."+domain);
  383. }
  384. }
  385. };
  386. static bool inNoProxy(const SharedHandle<Request>& req,
  387. const std::string& noProxy)
  388. {
  389. std::deque<std::string> entries;
  390. Util::slice(entries, noProxy, ',', true);
  391. if(entries.empty()) {
  392. return false;
  393. }
  394. return
  395. std::find_if(entries.begin(), entries.end(),
  396. DomainMatch("."+req->getHost())) != entries.end();
  397. }
  398. bool AbstractCommand::isProxyDefined() const
  399. {
  400. return isProxyRequest(req->getProtocol(), getOption()) &&
  401. !inNoProxy(req, getOption()->get(PREF_NO_PROXY));
  402. }
  403. static const std::string& getProxyString(const SharedHandle<Request>& req,
  404. const SharedHandle<Option>& option)
  405. {
  406. if(req->getProtocol() == Request::PROTO_HTTP) {
  407. return getProxyStringFor(PREF_HTTP_PROXY, option);
  408. } else if(req->getProtocol() == Request::PROTO_HTTPS) {
  409. return getProxyStringFor(PREF_HTTPS_PROXY, option);
  410. } else if(req->getProtocol() == Request::PROTO_FTP) {
  411. return getProxyStringFor(PREF_FTP_PROXY, option);
  412. } else {
  413. return A2STR::NIL;
  414. }
  415. }
  416. SharedHandle<Request> AbstractCommand::createProxyRequest() const
  417. {
  418. SharedHandle<Request> proxyRequest;
  419. if(inNoProxy(req, getOption()->get(PREF_NO_PROXY))) {
  420. return proxyRequest;
  421. }
  422. std::string proxy = getProxyString(req, getOption());
  423. if(!proxy.empty()) {
  424. proxyRequest.reset(new Request());
  425. if(proxyRequest->setUrl(proxy)) {
  426. logger->debug("CUID#%d - Using proxy", cuid);
  427. } else {
  428. logger->debug("CUID#%d - Failed to parse proxy string", cuid);
  429. proxyRequest.reset();
  430. }
  431. }
  432. return proxyRequest;
  433. }
  434. #ifdef ENABLE_ASYNC_DNS
  435. bool AbstractCommand::isAsyncNameResolverInitialized() const
  436. {
  437. return !_asyncNameResolver.isNull();
  438. }
  439. void AbstractCommand::initAsyncNameResolver(const std::string& hostname)
  440. {
  441. _asyncNameResolver.reset(new AsyncNameResolver());
  442. logger->info(MSG_RESOLVING_HOSTNAME, cuid, hostname.c_str());
  443. _asyncNameResolver->resolve(hostname);
  444. setNameResolverCheck(_asyncNameResolver);
  445. }
  446. bool AbstractCommand::asyncResolveHostname()
  447. {
  448. switch(_asyncNameResolver->getStatus()) {
  449. case AsyncNameResolver::STATUS_SUCCESS:
  450. return true;
  451. case AsyncNameResolver::STATUS_ERROR:
  452. if(!isProxyRequest(req->getProtocol(), getOption())) {
  453. e->_requestGroupMan->getOrCreateServerStat
  454. (req->getHost(), req->getProtocol())->setError();
  455. }
  456. throw DL_ABORT_EX(StringFormat(MSG_NAME_RESOLUTION_FAILED, cuid,
  457. _asyncNameResolver->getHostname().c_str(),
  458. _asyncNameResolver->getError().c_str()).str());
  459. default:
  460. return false;
  461. }
  462. }
  463. const std::deque<std::string>& AbstractCommand::getResolvedAddresses()
  464. {
  465. return _asyncNameResolver->getResolvedAddresses();
  466. }
  467. void AbstractCommand::setNameResolverCheck
  468. (const SharedHandle<AsyncNameResolver>& resolver) {
  469. if(!resolver.isNull()) {
  470. nameResolverCheck = true;
  471. e->addNameResolverCheck(resolver, this);
  472. }
  473. }
  474. void AbstractCommand::disableNameResolverCheck
  475. (const SharedHandle<AsyncNameResolver>& resolver) {
  476. if(!resolver.isNull()) {
  477. nameResolverCheck = false;
  478. e->deleteNameResolverCheck(resolver, this);
  479. }
  480. }
  481. bool AbstractCommand::nameResolveFinished() const {
  482. return
  483. _asyncNameResolver->getStatus() == AsyncNameResolver::STATUS_SUCCESS ||
  484. _asyncNameResolver->getStatus() == AsyncNameResolver::STATUS_ERROR;
  485. }
  486. #endif // ENABLE_ASYNC_DNS
  487. void AbstractCommand::prepareForNextAction(Command* nextCommand)
  488. {
  489. CheckIntegrityEntryHandle entry
  490. (new StreamCheckIntegrityEntry(_requestGroup, nextCommand));
  491. std::deque<Command*> commands;
  492. _requestGroup->processCheckIntegrityEntry(commands, entry, e);
  493. e->addCommand(commands);
  494. e->setNoWait(true);
  495. }
  496. bool AbstractCommand::checkIfConnectionEstablished
  497. (const SharedHandle<SocketCore>& socket,
  498. const std::string& connectedHostname,
  499. const std::string& connectedAddr,
  500. uint16_t connectedPort)
  501. {
  502. if(socket->isReadable(0)) {
  503. std::string error = socket->getSocketError();
  504. if(!error.empty()) {
  505. e->markBadIPAddress(connectedHostname, connectedAddr, connectedPort);
  506. if(!e->findCachedIPAddress(connectedHostname, connectedPort).empty()) {
  507. logger->info("CUID#%d - Could not to connect to %s:%u."
  508. " Trying another address",
  509. cuid, connectedAddr.c_str(), connectedPort);
  510. Command* command =
  511. InitiateConnectionCommandFactory::createInitiateConnectionCommand
  512. (cuid, req, _fileEntry, _requestGroup, e);
  513. e->setNoWait(true);
  514. e->commands.push_back(command);
  515. return false;
  516. }
  517. e->removeCachedIPAddress(connectedHostname, connectedPort);
  518. // Don't set error if proxy server is used and its method is GET.
  519. if(resolveProxyMethod(req->getProtocol()) != V_GET ||
  520. !isProxyRequest(req->getProtocol(), getOption())) {
  521. e->_requestGroupMan->getOrCreateServerStat
  522. (req->getHost(), req->getProtocol())->setError();
  523. }
  524. throw DL_RETRY_EX
  525. (StringFormat(MSG_ESTABLISHING_CONNECTION_FAILED, error.c_str()).str());
  526. }
  527. }
  528. return true;
  529. }
  530. const std::string& AbstractCommand::resolveProxyMethod
  531. (const std::string& protocol) const
  532. {
  533. if(getOption()->get(PREF_PROXY_METHOD) == V_TUNNEL ||
  534. Request::PROTO_HTTPS == protocol) {
  535. return V_TUNNEL;
  536. } else {
  537. return V_GET;
  538. }
  539. }
  540. const SharedHandle<Option>& AbstractCommand::getOption() const
  541. {
  542. return _requestGroup->getOption();
  543. }
  544. } // namespace aria2