diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-03-26 17:12:52 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-03-26 17:20:27 +0900 |
| commit | d64089632e82a2548752c7a6baaa68365a795a74 (patch) | |
| tree | 57fc7b85a8c1290975d58fa4761b04a7695bf7e3 /src/InitiateConnectionCommandFactory.cc | |
| parent | c81b1321122e8509b55c94c0cbca0d8d6d319f0c (diff) | |
| parent | a7cd943a06b1a5ff4515b57060b84037f8d01f9f (diff) | |
Merge branch 'master' into random-webseeding
Diffstat (limited to 'src/InitiateConnectionCommandFactory.cc')
| -rw-r--r-- | src/InitiateConnectionCommandFactory.cc | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/src/InitiateConnectionCommandFactory.cc b/src/InitiateConnectionCommandFactory.cc index b4615d7a..ecaafa5b 100644 --- a/src/InitiateConnectionCommandFactory.cc +++ b/src/InitiateConnectionCommandFactory.cc @@ -48,46 +48,45 @@ namespace aria2 { std::unique_ptr<Command> -InitiateConnectionCommandFactory::createInitiateConnectionCommand -(cuid_t cuid, - const std::shared_ptr<Request>& req, - const std::shared_ptr<FileEntry>& fileEntry, - RequestGroup* requestGroup, - DownloadEngine* e) +InitiateConnectionCommandFactory::createInitiateConnectionCommand( + cuid_t cuid, const std::shared_ptr<Request>& req, + const std::shared_ptr<FileEntry>& fileEntry, RequestGroup* requestGroup, + DownloadEngine* e) { - if(req->getProtocol() == "http" + if (req->getProtocol() == "http" #ifdef ENABLE_SSL - // for SSL - || req->getProtocol() == "https" + // for SSL + || + req->getProtocol() == "https" #endif // ENABLE_SSL - ) { + ) { - if(requestGroup->getOption()->getAsBool(PREF_ENABLE_HTTP_KEEP_ALIVE)) { + if (requestGroup->getOption()->getAsBool(PREF_ENABLE_HTTP_KEEP_ALIVE)) { req->setKeepAliveHint(true); } - if(requestGroup->getOption()->getAsBool(PREF_ENABLE_HTTP_PIPELINING)) { + if (requestGroup->getOption()->getAsBool(PREF_ENABLE_HTTP_PIPELINING)) { req->setPipeliningHint(true); } return make_unique<HttpInitiateConnectionCommand>(cuid, req, fileEntry, requestGroup, e); - } else if(req->getProtocol() == "ftp" + } + else if (req->getProtocol() == "ftp" #ifdef HAVE_LIBSSH2 - || req->getProtocol() == "sftp" + || req->getProtocol() == "sftp" #endif // HAVE_LIBSSH2 - ) { - if(req->getFile().empty()) { - throw DL_ABORT_EX - (fmt("FTP/SFTP URI %s doesn't contain file path.", - req->getUri().c_str())); + ) { + if (req->getFile().empty()) { + throw DL_ABORT_EX(fmt("FTP/SFTP URI %s doesn't contain file path.", + req->getUri().c_str())); } return make_unique<FtpInitiateConnectionCommand>(cuid, req, fileEntry, requestGroup, e); - } else { + } + else { // these protocols are not supported yet - throw DL_ABORT_EX - (fmt("%s is not supported yet.", - req->getProtocol().c_str())); + throw DL_ABORT_EX( + fmt("%s is not supported yet.", req->getProtocol().c_str())); } } |
