/* */ #include "InitiateConnectionCommandFactory.h" #include "HttpInitiateConnectionCommand.h" #include "FtpInitiateConnectionCommand.h" #include "Request.h" #include "RequestGroup.h" #include "DownloadEngine.h" #include "DlAbortEx.h" #include "StringFormat.h" #include "Option.h" #include "prefs.h" #include "SocketCore.h" namespace aria2 { Command* InitiateConnectionCommandFactory::createInitiateConnectionCommand(int32_t cuid, const RequestHandle& req, RequestGroup* requestGroup, DownloadEngine* e) { if(req->getProtocol() == Request::PROTO_HTTP #ifdef ENABLE_SSL // for SSL || req->getProtocol() == Request::PROTO_HTTPS #endif // ENABLE_SSL ) { if(e->option->getAsBool(PREF_ENABLE_HTTP_KEEP_ALIVE)) { req->setKeepAliveHint(true); } if(e->option->getAsBool(PREF_ENABLE_HTTP_PIPELINING)) { req->setPipeliningHint(true); } return new HttpInitiateConnectionCommand(cuid, req, requestGroup, e); } else if(req->getProtocol() == Request::PROTO_FTP) { return new FtpInitiateConnectionCommand(cuid, req, requestGroup, e); } else { // these protocols are not supported yet throw DlAbortEx (StringFormat("%s is not supported yet.", req->getProtocol().c_str()).str()); } } } // namespace aria2