mirror of
https://github.com/aria2/aria2.git
synced 2025-01-01 15:44:55 +00:00
sftp: Add SFTP and libssh2 to feature summary, and add tests
This commit is contained in:
parent
17a642551f
commit
2758fba10c
@ -67,7 +67,9 @@
|
|||||||
#ifdef HAVE_SYS_UTSNAME_H
|
#ifdef HAVE_SYS_UTSNAME_H
|
||||||
# include <sys/utsname.h>
|
# include <sys/utsname.h>
|
||||||
#endif // HAVE_SYS_UTSNAME_H
|
#endif // HAVE_SYS_UTSNAME_H
|
||||||
|
#ifdef HAVE_LIBSSH2
|
||||||
|
# include <libssh2.h>
|
||||||
|
#endif // HAVE_LIBSSH2
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
@ -168,6 +170,14 @@ const char* strSupportedFeature(int feature)
|
|||||||
#endif // !ENABLE_XML_RPC
|
#endif // !ENABLE_XML_RPC
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case(FEATURE_SFTP):
|
||||||
|
#ifdef HAVE_LIBSSH2
|
||||||
|
return "SFTP";
|
||||||
|
#else // !HAVE_LIBSSH2
|
||||||
|
return nullptr;
|
||||||
|
#endif // !HAVE_LIBSSH2
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -223,6 +233,11 @@ std::string usedLibs()
|
|||||||
#ifdef HAVE_LIBCARES
|
#ifdef HAVE_LIBCARES
|
||||||
res += "c-ares/" ARES_VERSION_STR " ";
|
res += "c-ares/" ARES_VERSION_STR " ";
|
||||||
#endif // HAVE_LIBCARES
|
#endif // HAVE_LIBCARES
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBSSH2
|
||||||
|
res += "libssh2/" LIBSSH2_VERSION " ";
|
||||||
|
#endif // HAVE_LIBSSH2
|
||||||
|
|
||||||
if(!res.empty()) {
|
if(!res.empty()) {
|
||||||
res.erase(res.length()-1);
|
res.erase(res.length()-1);
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ enum FeatureType {
|
|||||||
FEATURE_MESSAGE_DIGEST,
|
FEATURE_MESSAGE_DIGEST,
|
||||||
FEATURE_METALINK,
|
FEATURE_METALINK,
|
||||||
FEATURE_XML_RPC,
|
FEATURE_XML_RPC,
|
||||||
|
FEATURE_SFTP,
|
||||||
MAX_FEATURE
|
MAX_FEATURE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ void FeatureConfigTest::testGetDefaultPort() {
|
|||||||
CPPUNIT_ASSERT_EQUAL((uint16_t)80, getDefaultPort("http"));
|
CPPUNIT_ASSERT_EQUAL((uint16_t)80, getDefaultPort("http"));
|
||||||
CPPUNIT_ASSERT_EQUAL((uint16_t)443, getDefaultPort("https"));
|
CPPUNIT_ASSERT_EQUAL((uint16_t)443, getDefaultPort("https"));
|
||||||
CPPUNIT_ASSERT_EQUAL((uint16_t)21, getDefaultPort("ftp"));
|
CPPUNIT_ASSERT_EQUAL((uint16_t)21, getDefaultPort("ftp"));
|
||||||
|
CPPUNIT_ASSERT_EQUAL((uint16_t)22, getDefaultPort("sftp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeatureConfigTest::testStrSupportedFeature() {
|
void FeatureConfigTest::testStrSupportedFeature() {
|
||||||
@ -40,6 +41,13 @@ void FeatureConfigTest::testStrSupportedFeature() {
|
|||||||
CPPUNIT_ASSERT(!https);
|
CPPUNIT_ASSERT(!https);
|
||||||
#endif // ENABLE_SSL
|
#endif // ENABLE_SSL
|
||||||
CPPUNIT_ASSERT(!strSupportedFeature(MAX_FEATURE));
|
CPPUNIT_ASSERT(!strSupportedFeature(MAX_FEATURE));
|
||||||
|
|
||||||
|
auto sftp = strSupportedFeature(FEATURE_SFTP);
|
||||||
|
#ifdef HAVE_LIBSSH2
|
||||||
|
CPPUNIT_ASSERT(sftp);
|
||||||
|
#else // !HAVE_LIBSSH2
|
||||||
|
CPPUNIT_ASSERT(!sftp);
|
||||||
|
#endif // !HAVE_LIBSSH2
|
||||||
}
|
}
|
||||||
|
|
||||||
void FeatureConfigTest::testFeatureSummary() {
|
void FeatureConfigTest::testFeatureSummary() {
|
||||||
@ -75,6 +83,9 @@ void FeatureConfigTest::testFeatureSummary() {
|
|||||||
"XML-RPC",
|
"XML-RPC",
|
||||||
#endif // ENABLE_XML_RPC
|
#endif // ENABLE_XML_RPC
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBSSH2
|
||||||
|
"SFTP",
|
||||||
|
#endif // HAVE_LIBSSH2
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string featuresString = strjoin(std::begin(features),
|
std::string featuresString = strjoin(std::begin(features),
|
||||||
|
Loading…
Reference in New Issue
Block a user