diff --git a/src/FtpInitiateConnectionCommand.cc b/src/FtpInitiateConnectionCommand.cc index 78c0ca0c..ae3e20e1 100644 --- a/src/FtpInitiateConnectionCommand.cc +++ b/src/FtpInitiateConnectionCommand.cc @@ -132,6 +132,7 @@ std::unique_ptr FtpInitiateConnectionCommand::createNextCommandProxied setConnectedAddrInfo(getRequest(), hostname, pooledSocket); if(proxyMethod == V_TUNNEL) { +#ifdef HAVE_LIBSSH2 if (getRequest()->getProtocol() == "sftp") { return make_unique (getCuid(), @@ -142,6 +143,7 @@ std::unique_ptr FtpInitiateConnectionCommand::createNextCommandProxied pooledSocket, SftpNegotiationCommand::SEQ_SFTP_OPEN); } +#endif // HAVE_LIBSSH2 // options contains "baseWorkingDir" return make_unique @@ -206,7 +208,11 @@ std::unique_ptr FtpInitiateConnectionCommand::createNextCommandPlain getSocket()); if(getRequest()->getProtocol() == "sftp") { +#ifdef HAVE_LIBSSH2 c->setControlChain(std::make_shared()); +#else // !HAVE_LIBSSH2 + assert(0); +#endif // !HAVE_LIBSSH2 } else { c->setControlChain(std::make_shared()); } @@ -216,6 +222,7 @@ std::unique_ptr FtpInitiateConnectionCommand::createNextCommandPlain setConnectedAddrInfo(getRequest(), hostname, pooledSocket); +#ifdef HAVE_LIBSSH2 if (getRequest()->getProtocol() == "sftp") { return make_unique (getCuid(), @@ -226,6 +233,7 @@ std::unique_ptr FtpInitiateConnectionCommand::createNextCommandPlain pooledSocket, SftpNegotiationCommand::SEQ_SFTP_OPEN); } +#endif // HAVE_LIBSSH2 // options contains "baseWorkingDir" return make_unique diff --git a/src/FtpTunnelResponseCommand.cc b/src/FtpTunnelResponseCommand.cc index 9283e75e..057a5e89 100644 --- a/src/FtpTunnelResponseCommand.cc +++ b/src/FtpTunnelResponseCommand.cc @@ -40,7 +40,9 @@ #include "Segment.h" #include "SocketCore.h" #include "SocketRecvBuffer.h" -#include "SftpNegotiationCommand.h" +#ifdef HAVE_LIBSSH2 +# include "SftpNegotiationCommand.h" +#endif // HAVE_LIBSSH2 namespace aria2 { @@ -60,12 +62,14 @@ FtpTunnelResponseCommand::~FtpTunnelResponseCommand() {} std::unique_ptr FtpTunnelResponseCommand::getNextCommand() { +#ifdef HAVE_LIBSSH2 if (getRequest()->getProtocol() == "sftp") { return make_unique (getCuid(), getRequest(), getFileEntry(), getRequestGroup(), getDownloadEngine(), getSocket()); } +#endif // HAVE_LIBSSH2 return make_unique (getCuid(), getRequest(), getFileEntry(),