FtpNegotiationCommand.cc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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 "FtpNegotiationCommand.h"
  36. #include <stdint.h>
  37. #include <cassert>
  38. #include <utility>
  39. #include <map>
  40. #include "Request.h"
  41. #include "DownloadEngine.h"
  42. #include "FtpConnection.h"
  43. #include "RequestGroup.h"
  44. #include "PieceStorage.h"
  45. #include "FtpDownloadCommand.h"
  46. #include "FileEntry.h"
  47. #include "DlAbortEx.h"
  48. #include "message.h"
  49. #include "prefs.h"
  50. #include "Util.h"
  51. #include "Option.h"
  52. #include "Logger.h"
  53. #include "Segment.h"
  54. #include "SingleFileDownloadContext.h"
  55. #include "DefaultBtProgressInfoFile.h"
  56. #include "RequestGroupMan.h"
  57. #include "DownloadFailureException.h"
  58. #include "ServerHost.h"
  59. #include "Socket.h"
  60. #include "StringFormat.h"
  61. #include "DiskAdaptor.h"
  62. #include "SegmentMan.h"
  63. #include "AuthConfigFactory.h"
  64. #include "AuthConfig.h"
  65. namespace aria2 {
  66. FtpNegotiationCommand::FtpNegotiationCommand(int32_t cuid,
  67. const RequestHandle& req,
  68. RequestGroup* requestGroup,
  69. DownloadEngine* e,
  70. const SocketHandle& s,
  71. Seq seq,
  72. const std::string& baseWorkingDir):
  73. AbstractCommand(cuid, req, requestGroup, e, s), sequence(seq),
  74. ftp(new FtpConnection(cuid, socket, req,
  75. e->getAuthConfigFactory()->createAuthConfig(req),
  76. e->option))
  77. {
  78. ftp->setBaseWorkingDir(baseWorkingDir);
  79. if(seq == SEQ_RECV_GREETING) {
  80. setTimeout(e->option->getAsInt(PREF_CONNECT_TIMEOUT));
  81. }
  82. disableReadCheckSocket();
  83. setWriteCheckSocket(socket);
  84. }
  85. FtpNegotiationCommand::~FtpNegotiationCommand() {}
  86. bool FtpNegotiationCommand::executeInternal() {
  87. while(processSequence(_segments.front()));
  88. if(sequence == SEQ_RETRY) {
  89. return prepareForRetry(0);
  90. } else if(sequence == SEQ_NEGOTIATION_COMPLETED) {
  91. FtpDownloadCommand* command =
  92. new FtpDownloadCommand(cuid, req, _requestGroup, ftp, e, dataSocket, socket);
  93. command->setStartupIdleTime(e->option->getAsInt(PREF_STARTUP_IDLE_TIME));
  94. command->setLowestDownloadSpeedLimit(e->option->getAsInt(PREF_LOWEST_SPEED_LIMIT));
  95. if(!_requestGroup->isSingleHostMultiConnectionEnabled()) {
  96. SharedHandle<ServerHost> sv =
  97. _requestGroup->searchServerHost(req->getHost());
  98. if(!sv.isNull()) {
  99. _requestGroup->removeURIWhoseHostnameIs(sv->getHostname());
  100. }
  101. }
  102. _requestGroup->tuneDownloadCommand(command);
  103. e->commands.push_back(command);
  104. return true;
  105. } else if(sequence == SEQ_HEAD_OK || sequence == SEQ_DOWNLOAD_ALREADY_COMPLETED) {
  106. return true;
  107. } else if(sequence == SEQ_FILE_PREPARATION) {
  108. if(e->option->getAsBool(PREF_FTP_PASV)) {
  109. sequence = SEQ_SEND_PASV;
  110. } else {
  111. sequence = SEQ_PREPARE_SERVER_SOCKET;
  112. }
  113. return false;
  114. } else {
  115. e->commands.push_back(this);
  116. return false;
  117. }
  118. }
  119. bool FtpNegotiationCommand::recvGreeting() {
  120. checkIfConnectionEstablished(socket);
  121. setTimeout(_requestGroup->getTimeout());
  122. //socket->setBlockingMode();
  123. disableWriteCheckSocket();
  124. setReadCheckSocket(socket);
  125. unsigned int status = ftp->receiveResponse();
  126. if(status == 0) {
  127. return false;
  128. }
  129. if(status != 220) {
  130. throw DlAbortEx(EX_CONNECTION_FAILED);
  131. }
  132. sequence = SEQ_SEND_USER;
  133. return true;
  134. }
  135. bool FtpNegotiationCommand::sendUser() {
  136. if(ftp->sendUser()) {
  137. disableWriteCheckSocket();
  138. sequence = SEQ_RECV_USER;
  139. } else {
  140. setWriteCheckSocket(socket);
  141. }
  142. return false;
  143. }
  144. bool FtpNegotiationCommand::recvUser() {
  145. unsigned int status = ftp->receiveResponse();
  146. switch(status) {
  147. case 0:
  148. return false;
  149. case 230:
  150. sequence = SEQ_SEND_TYPE;
  151. break;
  152. case 331:
  153. sequence = SEQ_SEND_PASS;
  154. break;
  155. default:
  156. throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
  157. }
  158. return true;
  159. }
  160. bool FtpNegotiationCommand::sendPass() {
  161. if(ftp->sendPass()) {
  162. disableWriteCheckSocket();
  163. sequence = SEQ_RECV_PASS;
  164. } else {
  165. setWriteCheckSocket(socket);
  166. }
  167. return false;
  168. }
  169. bool FtpNegotiationCommand::recvPass() {
  170. unsigned int status = ftp->receiveResponse();
  171. if(status == 0) {
  172. return false;
  173. }
  174. if(status != 230) {
  175. throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
  176. }
  177. sequence = SEQ_SEND_TYPE;
  178. return true;
  179. }
  180. bool FtpNegotiationCommand::sendType() {
  181. if(ftp->sendType()) {
  182. disableWriteCheckSocket();
  183. sequence = SEQ_RECV_TYPE;
  184. } else {
  185. setWriteCheckSocket(socket);
  186. }
  187. return false;
  188. }
  189. bool FtpNegotiationCommand::recvType() {
  190. unsigned int status = ftp->receiveResponse();
  191. if(status == 0) {
  192. return false;
  193. }
  194. if(status != 200) {
  195. throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
  196. }
  197. sequence = SEQ_SEND_PWD;
  198. return true;
  199. }
  200. bool FtpNegotiationCommand::sendPwd()
  201. {
  202. if(ftp->sendPwd()) {
  203. disableWriteCheckSocket();
  204. sequence = SEQ_RECV_PWD;
  205. } else {
  206. setWriteCheckSocket(socket);
  207. }
  208. return false;
  209. }
  210. bool FtpNegotiationCommand::recvPwd()
  211. {
  212. std::string pwd;
  213. unsigned int status = ftp->receivePwdResponse(pwd);
  214. if(status == 0) {
  215. return false;
  216. }
  217. if(status != 257) {
  218. throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
  219. }
  220. ftp->setBaseWorkingDir(pwd);
  221. logger->info("CUID#%d - base working directory is '%s'", cuid, pwd.c_str());
  222. sequence = SEQ_SEND_CWD;
  223. return true;
  224. }
  225. bool FtpNegotiationCommand::sendCwd() {
  226. // Calling setReadCheckSocket() is needed when the socket is reused,
  227. setReadCheckSocket(socket);
  228. if(ftp->sendCwd()) {
  229. disableWriteCheckSocket();
  230. sequence = SEQ_RECV_CWD;
  231. } else {
  232. setWriteCheckSocket(socket);
  233. }
  234. return false;
  235. }
  236. bool FtpNegotiationCommand::recvCwd() {
  237. unsigned int status = ftp->receiveResponse();
  238. if(status == 0) {
  239. return false;
  240. }
  241. if(status != 250) {
  242. poolConnection();
  243. _requestGroup->increaseAndValidateFileNotFoundCount();
  244. if (status == 550)
  245. throw DlAbortEx(MSG_RESOURCE_NOT_FOUND, DownloadResult::RESOURCE_NOT_FOUND);
  246. else
  247. throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
  248. }
  249. if(e->option->getAsBool(PREF_REMOTE_TIME)) {
  250. sequence = SEQ_SEND_MDTM;
  251. } else {
  252. sequence = SEQ_SEND_SIZE;
  253. }
  254. return true;
  255. }
  256. bool FtpNegotiationCommand::sendMdtm()
  257. {
  258. if(ftp->sendMdtm()) {
  259. disableWriteCheckSocket();
  260. sequence = SEQ_RECV_MDTM;
  261. } else {
  262. setWriteCheckSocket(socket);
  263. }
  264. return false;
  265. }
  266. bool FtpNegotiationCommand::recvMdtm()
  267. {
  268. Time lastModifiedTime = Time::null();
  269. unsigned int status = ftp->receiveMdtmResponse(lastModifiedTime);
  270. if(status == 0) {
  271. return false;
  272. }
  273. if(status == 213) {
  274. if(lastModifiedTime.good()) {
  275. _requestGroup->updateLastModifiedTime(lastModifiedTime);
  276. time_t t = lastModifiedTime.getTime();
  277. struct tm* tms = gmtime(&t); // returned struct is statically allocated.
  278. if(tms) {
  279. logger->debug("MDTM result was parsed as: %s GMT", asctime(tms));
  280. } else {
  281. logger->debug("gmtime() failed for MDTM result.");
  282. }
  283. } else {
  284. logger->debug("MDTM response was returned, but it seems not to be a time"
  285. " value as in specified in RFC3659.");
  286. }
  287. } else {
  288. logger->info("CUID#%d - MDTM command failed.", cuid);
  289. }
  290. sequence = SEQ_SEND_SIZE;
  291. return true;
  292. }
  293. bool FtpNegotiationCommand::sendSize() {
  294. if(ftp->sendSize()) {
  295. disableWriteCheckSocket();
  296. sequence = SEQ_RECV_SIZE;
  297. } else {
  298. setWriteCheckSocket(socket);
  299. }
  300. return false;
  301. }
  302. bool FtpNegotiationCommand::onFileSizeDetermined(uint64_t totalLength)
  303. {
  304. SingleFileDownloadContextHandle dctx =
  305. dynamic_pointer_cast<SingleFileDownloadContext>(_requestGroup->getDownloadContext());
  306. dctx->setTotalLength(totalLength);
  307. dctx->setFilename(Util::urldecode(req->getFile()));
  308. _requestGroup->preDownloadProcessing();
  309. if(e->_requestGroupMan->isSameFileBeingDownloaded(_requestGroup)) {
  310. throw DownloadFailureException
  311. (StringFormat(EX_DUPLICATE_FILE_DOWNLOAD,
  312. _requestGroup->getFilePath().c_str()).str());
  313. }
  314. if(totalLength == 0) {
  315. if(e->option->getAsBool(PREF_FTP_PASV)) {
  316. sequence = SEQ_SEND_PASV;
  317. } else {
  318. sequence = SEQ_PREPARE_SERVER_SOCKET;
  319. }
  320. _requestGroup->initPieceStorage();
  321. if(dctx->knowsTotalLength() &&
  322. _requestGroup->downloadFinishedByFileLength()) {
  323. sequence = SEQ_DOWNLOAD_ALREADY_COMPLETED;
  324. poolConnection();
  325. return false;
  326. }
  327. _requestGroup->shouldCancelDownloadForSafety();
  328. _requestGroup->getPieceStorage()->getDiskAdaptor()->initAndOpenFile();
  329. if(dctx->knowsTotalLength()) {
  330. sequence = SEQ_DOWNLOAD_ALREADY_COMPLETED;
  331. poolConnection();
  332. return false;
  333. }
  334. return true;
  335. } else {
  336. _requestGroup->initPieceStorage();
  337. if(e->option->getAsBool(PREF_DRY_RUN)) {
  338. _requestGroup->getPieceStorage()->markAllPiecesDone();
  339. poolConnection();
  340. sequence = SEQ_HEAD_OK;
  341. return false;
  342. }
  343. BtProgressInfoFileHandle infoFile(new DefaultBtProgressInfoFile(_requestGroup->getDownloadContext(), _requestGroup->getPieceStorage(), e->option));
  344. if(!infoFile->exists() && _requestGroup->downloadFinishedByFileLength()) {
  345. sequence = SEQ_DOWNLOAD_ALREADY_COMPLETED;
  346. poolConnection();
  347. return false;
  348. }
  349. _requestGroup->loadAndOpenFile(infoFile);
  350. prepareForNextAction(this);
  351. disableReadCheckSocket();
  352. }
  353. return false;
  354. }
  355. bool FtpNegotiationCommand::recvSize() {
  356. uint64_t size = 0;
  357. unsigned int status = ftp->receiveSizeResponse(size);
  358. if(status == 0) {
  359. return false;
  360. }
  361. if(status == 213) {
  362. if(size > INT64_MAX) {
  363. throw DlAbortEx
  364. (StringFormat(EX_TOO_LARGE_FILE, Util::uitos(size, true).c_str()).str());
  365. }
  366. if(_requestGroup->getPieceStorage().isNull()) {
  367. sequence = SEQ_FILE_PREPARATION;
  368. return onFileSizeDetermined(size);
  369. } else {
  370. _requestGroup->validateTotalLength(size);
  371. }
  372. } else {
  373. logger->info("CUID#%d - The remote FTP Server doesn't recognize SIZE command. Continue.", cuid);
  374. // Even if one of the other servers waiting in the queue supports SIZE
  375. // command, resuming and segmented downloading are disabled when the first
  376. // contacted FTP server doesn't support it.
  377. if(_requestGroup->getPieceStorage().isNull()) {
  378. SingleFileDownloadContextHandle dctx =
  379. dynamic_pointer_cast<SingleFileDownloadContext>
  380. (_requestGroup->getDownloadContext());
  381. dctx->markTotalLengthIsUnknown();
  382. return onFileSizeDetermined(0);
  383. }
  384. // TODO Skipping RequestGroup::validateTotalLength(0) here will allow
  385. // wrong file to be downloaded if user-specified URL is wrong.
  386. }
  387. if(e->option->getAsBool(PREF_FTP_PASV)) {
  388. sequence = SEQ_SEND_PASV;
  389. } else {
  390. sequence = SEQ_PREPARE_SERVER_SOCKET;
  391. }
  392. return true;
  393. }
  394. void FtpNegotiationCommand::afterFileAllocation()
  395. {
  396. setReadCheckSocket(socket);
  397. }
  398. bool FtpNegotiationCommand::prepareServerSocket()
  399. {
  400. serverSocket = ftp->createServerSocket();
  401. sequence = SEQ_SEND_PORT;
  402. return true;
  403. }
  404. bool FtpNegotiationCommand::sendPort() {
  405. afterFileAllocation();
  406. if(ftp->sendPort(serverSocket)) {
  407. disableWriteCheckSocket();
  408. sequence = SEQ_RECV_PORT;
  409. } else {
  410. setWriteCheckSocket(socket);
  411. }
  412. return false;
  413. }
  414. bool FtpNegotiationCommand::recvPort() {
  415. unsigned int status = ftp->receiveResponse();
  416. if(status == 0) {
  417. return false;
  418. }
  419. if(status != 200) {
  420. throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
  421. }
  422. sequence = SEQ_SEND_REST;
  423. return true;
  424. }
  425. bool FtpNegotiationCommand::sendPasv() {
  426. afterFileAllocation();
  427. if(ftp->sendPasv()) {
  428. disableWriteCheckSocket();
  429. sequence = SEQ_RECV_PASV;
  430. } else {
  431. setWriteCheckSocket(socket);
  432. }
  433. return false;
  434. }
  435. bool FtpNegotiationCommand::recvPasv() {
  436. std::pair<std::string, uint16_t> dest;
  437. unsigned int status = ftp->receivePasvResponse(dest);
  438. if(status == 0) {
  439. return false;
  440. }
  441. if(status != 227) {
  442. throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
  443. }
  444. // make a data connection to the server.
  445. logger->info(MSG_CONNECTING_TO_SERVER, cuid,
  446. dest.first.c_str(),
  447. dest.second);
  448. dataSocket.reset(new SocketCore());
  449. dataSocket->establishConnection(dest.first, dest.second);
  450. disableReadCheckSocket();
  451. setWriteCheckSocket(dataSocket);
  452. sequence = SEQ_SEND_REST_PASV;
  453. return false;
  454. }
  455. bool FtpNegotiationCommand::sendRestPasv(const SegmentHandle& segment) {
  456. //dataSocket->setBlockingMode();
  457. setReadCheckSocket(socket);
  458. disableWriteCheckSocket();
  459. return sendRest(segment);
  460. }
  461. bool FtpNegotiationCommand::sendRest(const SegmentHandle& segment) {
  462. if(ftp->sendRest(segment)) {
  463. disableWriteCheckSocket();
  464. sequence = SEQ_RECV_REST;
  465. } else {
  466. setWriteCheckSocket(socket);
  467. }
  468. return false;
  469. }
  470. bool FtpNegotiationCommand::recvRest(const SharedHandle<Segment>& segment) {
  471. unsigned int status = ftp->receiveResponse();
  472. if(status == 0) {
  473. return false;
  474. }
  475. // If we recieve negative response and requested file position is not 0,
  476. // then throw exception here.
  477. if(status != 350) {
  478. if(!segment.isNull() && segment->getPositionToWrite() != 0) {
  479. throw DlAbortEx("FTP server doesn't support resuming.");
  480. }
  481. }
  482. sequence = SEQ_SEND_RETR;
  483. return true;
  484. }
  485. bool FtpNegotiationCommand::sendRetr() {
  486. if(ftp->sendRetr()) {
  487. disableWriteCheckSocket();
  488. sequence = SEQ_RECV_RETR;
  489. } else {
  490. setWriteCheckSocket(socket);
  491. }
  492. return false;
  493. }
  494. bool FtpNegotiationCommand::recvRetr() {
  495. unsigned int status = ftp->receiveResponse();
  496. if(status == 0) {
  497. return false;
  498. }
  499. if(status != 150 && status != 125) {
  500. _requestGroup->increaseAndValidateFileNotFoundCount();
  501. if (status == 550)
  502. throw DlAbortEx(MSG_RESOURCE_NOT_FOUND, DownloadResult::RESOURCE_NOT_FOUND);
  503. else
  504. throw DlAbortEx(StringFormat(EX_BAD_STATUS, status).str());
  505. }
  506. if(e->option->getAsBool(PREF_FTP_PASV)) {
  507. sequence = SEQ_NEGOTIATION_COMPLETED;
  508. return false;
  509. } else {
  510. disableReadCheckSocket();
  511. setReadCheckSocket(serverSocket);
  512. sequence = SEQ_WAIT_CONNECTION;
  513. return false;
  514. }
  515. }
  516. bool FtpNegotiationCommand::waitConnection()
  517. {
  518. disableReadCheckSocket();
  519. setReadCheckSocket(socket);
  520. dataSocket.reset(serverSocket->acceptConnection());
  521. //dataSocket->setBlockingMode();
  522. sequence = SEQ_NEGOTIATION_COMPLETED;
  523. return false;
  524. }
  525. bool FtpNegotiationCommand::processSequence(const SegmentHandle& segment) {
  526. bool doNextSequence = true;
  527. switch(sequence) {
  528. case SEQ_RECV_GREETING:
  529. return recvGreeting();
  530. case SEQ_SEND_USER:
  531. return sendUser();
  532. case SEQ_RECV_USER:
  533. return recvUser();
  534. case SEQ_SEND_PASS:
  535. return sendPass();
  536. case SEQ_RECV_PASS:
  537. return recvPass();
  538. case SEQ_SEND_TYPE:
  539. return sendType();
  540. case SEQ_RECV_TYPE:
  541. return recvType();
  542. case SEQ_SEND_PWD:
  543. return sendPwd();
  544. case SEQ_RECV_PWD:
  545. return recvPwd();
  546. case SEQ_SEND_CWD:
  547. return sendCwd();
  548. case SEQ_RECV_CWD:
  549. return recvCwd();
  550. case SEQ_SEND_MDTM:
  551. return sendMdtm();
  552. case SEQ_RECV_MDTM:
  553. return recvMdtm();
  554. case SEQ_SEND_SIZE:
  555. return sendSize();
  556. case SEQ_RECV_SIZE:
  557. return recvSize();
  558. case SEQ_PREPARE_SERVER_SOCKET:
  559. return prepareServerSocket();
  560. case SEQ_SEND_PORT:
  561. return sendPort();
  562. case SEQ_RECV_PORT:
  563. return recvPort();
  564. case SEQ_SEND_PASV:
  565. return sendPasv();
  566. case SEQ_RECV_PASV:
  567. return recvPasv();
  568. case SEQ_SEND_REST_PASV:
  569. return sendRestPasv(segment);
  570. case SEQ_SEND_REST:
  571. return sendRest(segment);
  572. case SEQ_RECV_REST:
  573. return recvRest(segment);
  574. case SEQ_SEND_RETR:
  575. return sendRetr();
  576. case SEQ_RECV_RETR:
  577. return recvRetr();
  578. case SEQ_WAIT_CONNECTION:
  579. return waitConnection();
  580. default:
  581. abort();
  582. }
  583. return doNextSequence;
  584. }
  585. void FtpNegotiationCommand::poolConnection() const
  586. {
  587. if(e->option->getAsBool(PREF_FTP_REUSE_CONNECTION)) {
  588. std::map<std::string, std::string> options;
  589. options["baseWorkingDir"] = ftp->getBaseWorkingDir();
  590. e->poolSocket(req, isProxyDefined(), socket, options);
  591. }
  592. }
  593. } // namespace aria2