AbstractCommand.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  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. // TODO it is not needed to check other PeerStats every time.
  102. // Find faster Request when no segment is available.
  103. if(!req.isNull() && _fileEntry->countPooledRequest() > 0 &&
  104. !_requestGroup->getPieceStorage()->hasMissingUnusedPiece()) {
  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(0);
  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. logger->debug("CUID#%d - Not trying next request."
  234. " No reserved/pooled request is remaining and"
  235. " total length is still unknown.", cuid);
  236. return;
  237. }
  238. }
  239. logger->debug("CUID#%d - Trying reserved/pooled request.", cuid);
  240. Commands commands;
  241. _requestGroup->createNextCommand(commands, e, 1);
  242. e->setNoWait(true);
  243. e->addCommand(commands);
  244. }
  245. bool AbstractCommand::prepareForRetry(time_t wait) {
  246. if(!_requestGroup->getPieceStorage().isNull()) {
  247. _requestGroup->getSegmentMan()->cancelSegment(cuid);
  248. }
  249. if(!req.isNull()) {
  250. _fileEntry->poolRequest(req);
  251. logger->debug("CUID#%d - Pooling request URI=%s",
  252. cuid, req->getUrl().c_str());
  253. if(!_requestGroup->getSegmentMan().isNull()) {
  254. _requestGroup->getSegmentMan()->recognizeSegmentFor(_fileEntry);
  255. }
  256. }
  257. Command* command = new CreateRequestCommand(cuid, _requestGroup, e);
  258. if(wait == 0) {
  259. e->setNoWait(true);
  260. e->commands.push_back(command);
  261. } else {
  262. SleepCommand* scom = new SleepCommand(cuid, e, _requestGroup,
  263. command, wait);
  264. e->commands.push_back(scom);
  265. }
  266. return true;
  267. }
  268. void AbstractCommand::onAbort() {
  269. if(!req.isNull()) {
  270. // TODO This might be a problem if the failure is caused by proxy.
  271. e->_requestGroupMan->getOrCreateServerStat(req->getHost(),
  272. req->getProtocol())->setError();
  273. _fileEntry->removeIdenticalURI(req->getUrl());
  274. _fileEntry->removeRequest(req);
  275. }
  276. logger->debug("CUID#%d - Aborting download", cuid);
  277. if(!_requestGroup->getPieceStorage().isNull()) {
  278. _requestGroup->getSegmentMan()->cancelSegment(cuid);
  279. }
  280. }
  281. void AbstractCommand::disableReadCheckSocket() {
  282. if(checkSocketIsReadable) {
  283. e->deleteSocketForReadCheck(readCheckTarget, this);
  284. checkSocketIsReadable = false;
  285. readCheckTarget = SocketHandle();
  286. }
  287. }
  288. void AbstractCommand::setReadCheckSocket(const SocketHandle& socket) {
  289. if(!socket->isOpen()) {
  290. disableReadCheckSocket();
  291. } else {
  292. if(checkSocketIsReadable) {
  293. if(readCheckTarget != socket) {
  294. e->deleteSocketForReadCheck(readCheckTarget, this);
  295. e->addSocketForReadCheck(socket, this);
  296. readCheckTarget = socket;
  297. }
  298. } else {
  299. e->addSocketForReadCheck(socket, this);
  300. checkSocketIsReadable = true;
  301. readCheckTarget = socket;
  302. }
  303. }
  304. }
  305. void AbstractCommand::setReadCheckSocketIf
  306. (const SharedHandle<SocketCore>& socket, bool pred)
  307. {
  308. if(pred) {
  309. setReadCheckSocket(socket);
  310. } else {
  311. disableReadCheckSocket();
  312. }
  313. }
  314. void AbstractCommand::disableWriteCheckSocket() {
  315. if(checkSocketIsWritable) {
  316. e->deleteSocketForWriteCheck(writeCheckTarget, this);
  317. checkSocketIsWritable = false;
  318. writeCheckTarget = SocketHandle();
  319. }
  320. }
  321. void AbstractCommand::setWriteCheckSocket(const SocketHandle& socket) {
  322. if(!socket->isOpen()) {
  323. disableWriteCheckSocket();
  324. } else {
  325. if(checkSocketIsWritable) {
  326. if(writeCheckTarget != socket) {
  327. e->deleteSocketForWriteCheck(writeCheckTarget, this);
  328. e->addSocketForWriteCheck(socket, this);
  329. writeCheckTarget = socket;
  330. }
  331. } else {
  332. e->addSocketForWriteCheck(socket, this);
  333. checkSocketIsWritable = true;
  334. writeCheckTarget = socket;
  335. }
  336. }
  337. }
  338. void AbstractCommand::setWriteCheckSocketIf
  339. (const SharedHandle<SocketCore>& socket, bool pred)
  340. {
  341. if(pred) {
  342. setWriteCheckSocket(socket);
  343. } else {
  344. disableWriteCheckSocket();
  345. }
  346. }
  347. static const std::string& getProxyStringFor(const std::string& proxyPref,
  348. const SharedHandle<Option>& option)
  349. {
  350. if(option->defined(proxyPref)) {
  351. return option->get(proxyPref);
  352. } else {
  353. return option->get(PREF_ALL_PROXY);
  354. }
  355. }
  356. static bool isProxyUsed(const std::string& proxyPref,
  357. const SharedHandle<Option>& option)
  358. {
  359. std::string proxy = getProxyStringFor(proxyPref, option);
  360. if(proxy.empty()) {
  361. return false;
  362. } else {
  363. return Request().setUrl(proxy);
  364. }
  365. }
  366. static bool isProxyRequest(const std::string& protocol,
  367. const SharedHandle<Option>& option)
  368. {
  369. return
  370. (protocol == Request::PROTO_HTTP && isProxyUsed(PREF_HTTP_PROXY, option)) ||
  371. (protocol == Request::PROTO_HTTPS && isProxyUsed(PREF_HTTPS_PROXY,option))||
  372. (protocol == Request::PROTO_FTP && isProxyUsed(PREF_FTP_PROXY, option));
  373. }
  374. class DomainMatch {
  375. private:
  376. std::string _hostname;
  377. public:
  378. DomainMatch(const std::string& hostname):_hostname(hostname) {}
  379. bool operator()(const std::string& domain) const
  380. {
  381. if(util::startsWith(domain, ".")) {
  382. return util::endsWith(_hostname, domain);
  383. } else {
  384. return util::endsWith(_hostname, "."+domain);
  385. }
  386. }
  387. };
  388. static bool inNoProxy(const SharedHandle<Request>& req,
  389. const std::string& noProxy)
  390. {
  391. std::vector<std::string> entries;
  392. util::split(noProxy, std::back_inserter(entries), ",", true);
  393. if(entries.empty()) {
  394. return false;
  395. }
  396. return
  397. std::find_if(entries.begin(), entries.end(),
  398. DomainMatch("."+req->getHost())) != entries.end();
  399. }
  400. bool AbstractCommand::isProxyDefined() const
  401. {
  402. return isProxyRequest(req->getProtocol(), getOption()) &&
  403. !inNoProxy(req, getOption()->get(PREF_NO_PROXY));
  404. }
  405. static const std::string& getProxyString(const SharedHandle<Request>& req,
  406. const SharedHandle<Option>& option)
  407. {
  408. if(req->getProtocol() == Request::PROTO_HTTP) {
  409. return getProxyStringFor(PREF_HTTP_PROXY, option);
  410. } else if(req->getProtocol() == Request::PROTO_HTTPS) {
  411. return getProxyStringFor(PREF_HTTPS_PROXY, option);
  412. } else if(req->getProtocol() == Request::PROTO_FTP) {
  413. return getProxyStringFor(PREF_FTP_PROXY, option);
  414. } else {
  415. return A2STR::NIL;
  416. }
  417. }
  418. SharedHandle<Request> AbstractCommand::createProxyRequest() const
  419. {
  420. SharedHandle<Request> proxyRequest;
  421. if(inNoProxy(req, getOption()->get(PREF_NO_PROXY))) {
  422. return proxyRequest;
  423. }
  424. std::string proxy = getProxyString(req, getOption());
  425. if(!proxy.empty()) {
  426. proxyRequest.reset(new Request());
  427. if(proxyRequest->setUrl(proxy)) {
  428. logger->debug("CUID#%d - Using proxy", cuid);
  429. } else {
  430. logger->debug("CUID#%d - Failed to parse proxy string", cuid);
  431. proxyRequest.reset();
  432. }
  433. }
  434. return proxyRequest;
  435. }
  436. #ifdef ENABLE_ASYNC_DNS
  437. bool AbstractCommand::isAsyncNameResolverInitialized() const
  438. {
  439. return !_asyncNameResolver.isNull();
  440. }
  441. void AbstractCommand::initAsyncNameResolver(const std::string& hostname)
  442. {
  443. _asyncNameResolver.reset(new AsyncNameResolver());
  444. logger->info(MSG_RESOLVING_HOSTNAME, cuid, hostname.c_str());
  445. _asyncNameResolver->resolve(hostname);
  446. setNameResolverCheck(_asyncNameResolver);
  447. }
  448. bool AbstractCommand::asyncResolveHostname()
  449. {
  450. switch(_asyncNameResolver->getStatus()) {
  451. case AsyncNameResolver::STATUS_SUCCESS:
  452. return true;
  453. case AsyncNameResolver::STATUS_ERROR:
  454. if(!isProxyRequest(req->getProtocol(), getOption())) {
  455. e->_requestGroupMan->getOrCreateServerStat
  456. (req->getHost(), req->getProtocol())->setError();
  457. }
  458. throw DL_ABORT_EX(StringFormat(MSG_NAME_RESOLUTION_FAILED, cuid,
  459. _asyncNameResolver->getHostname().c_str(),
  460. _asyncNameResolver->getError().c_str()).str());
  461. default:
  462. return false;
  463. }
  464. }
  465. const std::deque<std::string>& AbstractCommand::getResolvedAddresses()
  466. {
  467. return _asyncNameResolver->getResolvedAddresses();
  468. }
  469. void AbstractCommand::setNameResolverCheck
  470. (const SharedHandle<AsyncNameResolver>& resolver) {
  471. if(!resolver.isNull()) {
  472. nameResolverCheck = true;
  473. e->addNameResolverCheck(resolver, this);
  474. }
  475. }
  476. void AbstractCommand::disableNameResolverCheck
  477. (const SharedHandle<AsyncNameResolver>& resolver) {
  478. if(!resolver.isNull()) {
  479. nameResolverCheck = false;
  480. e->deleteNameResolverCheck(resolver, this);
  481. }
  482. }
  483. bool AbstractCommand::nameResolveFinished() const {
  484. return
  485. _asyncNameResolver->getStatus() == AsyncNameResolver::STATUS_SUCCESS ||
  486. _asyncNameResolver->getStatus() == AsyncNameResolver::STATUS_ERROR;
  487. }
  488. #endif // ENABLE_ASYNC_DNS
  489. void AbstractCommand::prepareForNextAction(Command* nextCommand)
  490. {
  491. CheckIntegrityEntryHandle entry
  492. (new StreamCheckIntegrityEntry(_requestGroup, nextCommand));
  493. std::deque<Command*> commands;
  494. try {
  495. _requestGroup->processCheckIntegrityEntry(commands, entry, e);
  496. } catch(RecoverableException& e) {
  497. std::for_each(commands.begin(), commands.end(), Deleter());
  498. throw;
  499. }
  500. e->addCommand(commands);
  501. e->setNoWait(true);
  502. }
  503. bool AbstractCommand::checkIfConnectionEstablished
  504. (const SharedHandle<SocketCore>& socket,
  505. const std::string& connectedHostname,
  506. const std::string& connectedAddr,
  507. uint16_t connectedPort)
  508. {
  509. if(socket->isReadable(0)) {
  510. std::string error = socket->getSocketError();
  511. if(!error.empty()) {
  512. // See also InitiateConnectionCommand::executeInternal()
  513. e->markBadIPAddress(connectedHostname, connectedAddr, connectedPort);
  514. if(!e->findCachedIPAddress(connectedHostname, connectedPort).empty()) {
  515. logger->info(MSG_CONNECT_FAILED_AND_RETRY,
  516. cuid, connectedAddr.c_str(), connectedPort);
  517. Command* command =
  518. InitiateConnectionCommandFactory::createInitiateConnectionCommand
  519. (cuid, req, _fileEntry, _requestGroup, e);
  520. e->setNoWait(true);
  521. e->commands.push_back(command);
  522. return false;
  523. }
  524. e->removeCachedIPAddress(connectedHostname, connectedPort);
  525. // Don't set error if proxy server is used and its method is GET.
  526. if(resolveProxyMethod(req->getProtocol()) != V_GET ||
  527. !isProxyRequest(req->getProtocol(), getOption())) {
  528. e->_requestGroupMan->getOrCreateServerStat
  529. (req->getHost(), req->getProtocol())->setError();
  530. }
  531. throw DL_RETRY_EX
  532. (StringFormat(MSG_ESTABLISHING_CONNECTION_FAILED, error.c_str()).str());
  533. }
  534. }
  535. return true;
  536. }
  537. const std::string& AbstractCommand::resolveProxyMethod
  538. (const std::string& protocol) const
  539. {
  540. if(getOption()->get(PREF_PROXY_METHOD) == V_TUNNEL ||
  541. Request::PROTO_HTTPS == protocol) {
  542. return V_TUNNEL;
  543. } else {
  544. return V_GET;
  545. }
  546. }
  547. const SharedHandle<Option>& AbstractCommand::getOption() const
  548. {
  549. return _requestGroup->getOption();
  550. }
  551. } // namespace aria2