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

Function cmCurlSetNETRCOption

Source/cmCurl.cxx:192–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192std::string cmCurlSetNETRCOption(::CURL* curl, std::string const& netrc_level,
193 std::string const& netrc_file)
194{
195 std::string e;
196 long curl_netrc_level = CURL_NETRC_LAST;
197 ::CURLcode res;
198
199 if (!netrc_level.empty()) {
200 if (netrc_level == "OPTIONAL") {
201 curl_netrc_level = CURL_NETRC_OPTIONAL;
202 } else if (netrc_level == "REQUIRED") {
203 curl_netrc_level = CURL_NETRC_REQUIRED;
204 } else if (netrc_level == "IGNORED") {
205 curl_netrc_level = CURL_NETRC_IGNORED;
206 } else {
207 e = cmStrCat("NETRC accepts OPTIONAL, IGNORED or REQUIRED but got: ",
208 netrc_level);
209 return e;
210 }
211 }
212
213 if (curl_netrc_level != CURL_NETRC_LAST &&
214 curl_netrc_level != CURL_NETRC_IGNORED) {
215 res = ::curl_easy_setopt(curl, CURLOPT_NETRC, curl_netrc_level);
216 check_curl_result(res, "Unable to set netrc level: ");
217 if (!e.empty()) {
218 return e;
219 }
220
221 // check to see if a .netrc file has been specified
222 if (!netrc_file.empty()) {
223 res = ::curl_easy_setopt(curl, CURLOPT_NETRC_FILE, netrc_file.c_str());
224 check_curl_result(res, "Unable to set .netrc file path : ");
225 }
226 }
227 return e;
228}
229
230::CURL* cm_curl_easy_init()
231{

Callers 2

HandleDownloadCommandFunction · 0.85
HandleUploadCommandFunction · 0.85

Calls 4

curl_easy_setoptFunction · 0.85
c_strMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…