#include #include #include #include template void split_path(std::string const &s, std::string const &delimiter, callable_t &&C ) { size_t pos_start = 0, pos_end, delim_len = delimiter.length(); while ((pos_end = s.find (delimiter, pos_start)) != std::string::npos) { std::string_view S( &s[pos_start], pos_end-pos_start); pos_start = pos_end + delim_len; C(S); } std::string_view S( &s[pos_start], s.size()-pos_start); C(S); } SCENARIO("Test download file") { gul::HTTP2 curl; curl.CURL_ADDITIONAL_FLAGS += " --insecure "; //curl.CURL_ADDITIONAL_FLAGS.clear(); REQUIRE( gul::fs::exists( curl.CURL_PATH)); auto path = curl.cache_file("https://ifconfig.me"); #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #else std::system("find /tmp"); #endif auto path2 = curl.get("https://ifconfig.me"); REQUIRE(path == path2); REQUIRE(gul::fs::exists(path2)); std::cout << path.string() << std::endl; }