MCPcopy Create free account
hub / github.com/Kitware/CMake / HandleDownloadCommand

Function HandleDownloadCommand

Source/cmFileCommand.cxx:1885–2389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1883 } while (false)
1884
1885bool HandleDownloadCommand(std::vector<std::string> const& args,
1886 cmExecutionStatus& status)
1887{
1888#if !defined(CMAKE_BOOTSTRAP)
1889 auto i = args.begin();
1890 if (args.size() < 2) {
1891 status.SetError("DOWNLOAD must be called with at least two arguments.");
1892 return false;
1893 }
1894 ++i; // Get rid of subcommand
1895 std::string url = *i;
1896 ++i;
1897 std::string file;
1898
1899 long timeout = 0;
1900 long inactivity_timeout = 0;
1901 std::string logVar;
1902 std::string statusVar;
1903 cm::optional<std::string> tlsVersionOpt;
1904 cm::optional<bool> tlsVerifyOpt;
1905 cmValue cainfo = status.GetMakefile().GetDefinition("CMAKE_TLS_CAINFO");
1906 std::string netrc_level =
1907 status.GetMakefile().GetSafeDefinition("CMAKE_NETRC");
1908 std::string netrc_file =
1909 status.GetMakefile().GetSafeDefinition("CMAKE_NETRC_FILE");
1910 std::string expectedHash;
1911 std::string hashMatchMSG;
1912 std::unique_ptr<cmCryptoHash> hash;
1913 bool showProgress = false;
1914 std::string userpwd;
1915
1916 std::vector<std::string> curl_headers;
1917 std::vector<std::pair<std::string, cm::optional<std::string>>> curl_ranges;
1918
1919 while (i != args.end()) {
1920 if (*i == "TIMEOUT") {
1921 ++i;
1922 if (i != args.end()) {
1923 timeout = atol(i->c_str());
1924 } else {
1925 status.SetError("DOWNLOAD missing time for TIMEOUT.");
1926 return false;
1927 }
1928 } else if (*i == "INACTIVITY_TIMEOUT") {
1929 ++i;
1930 if (i != args.end()) {
1931 inactivity_timeout = atol(i->c_str());
1932 } else {
1933 status.SetError("DOWNLOAD missing time for INACTIVITY_TIMEOUT.");
1934 return false;
1935 }
1936 } else if (*i == "LOG") {
1937 ++i;
1938 if (i == args.end()) {
1939 status.SetError("DOWNLOAD missing VAR for LOG.");
1940 return false;
1941 }
1942 logVar = *i;

Callers

nothing calls this directly

Calls 15

cmIsOnFunction · 0.85
moveFunction · 0.85
CurlCompatFileURLFunction · 0.85
cm_curl_global_initFunction · 0.85
cm_curl_easy_initFunction · 0.85
curl_easy_setoptFunction · 0.85
curl_version_infoFunction · 0.85
cmCurlParseTLSVersionFunction · 0.85
cmCurlSetCAInfoFunction · 0.85
cmCurlSetNETRCOptionFunction · 0.85
curl_slist_appendFunction · 0.85
curl_easy_performFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…