diff options
author | Brad King <brad.king@kitware.com> | 2016-07-19 12:26:05 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-07-19 12:26:05 (GMT) |
commit | 34216023e6160908ae50721504924ef3ab3ed4f9 (patch) | |
tree | 4e4728957768b169a50ab92db6ee6a48d73ff343 /Source/CTest/cmCTestCurl.cxx | |
parent | 6a44e34630180250b865134c2a0ccbf9993339ca (diff) | |
parent | b1f87a50b3aee129d420b8d789ebec55068e4ec5 (diff) | |
download | CMake-34216023e6160908ae50721504924ef3ab3ed4f9.zip CMake-34216023e6160908ae50721504924ef3ab3ed4f9.tar.gz CMake-34216023e6160908ae50721504924ef3ab3ed4f9.tar.bz2 |
Merge topic 'use-better-KWSys-GetEnv'
b1f87a50 Use better KWSys SystemTools::GetEnv and HasEnv signatures
Diffstat (limited to 'Source/CTest/cmCTestCurl.cxx')
-rw-r--r-- | Source/CTest/cmCTestCurl.cxx | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx index 6b8e5b5..b335e32 100644 --- a/Source/CTest/cmCTestCurl.cxx +++ b/Source/CTest/cmCTestCurl.cxx @@ -219,16 +219,18 @@ bool cmCTestCurl::HttpRequest(std::string const& url, void cmCTestCurl::SetProxyType() { - if (cmSystemTools::GetEnv("HTTP_PROXY")) { - this->HTTPProxy = cmSystemTools::GetEnv("HTTP_PROXY"); - if (cmSystemTools::GetEnv("HTTP_PROXY_PORT")) { + this->HTTPProxy = ""; + // this is the default + this->HTTPProxyType = CURLPROXY_HTTP; + this->HTTPProxyAuth = ""; + if (cmSystemTools::GetEnv("HTTP_PROXY", this->HTTPProxy)) { + std::string port; + if (cmSystemTools::GetEnv("HTTP_PROXY_PORT", port)) { this->HTTPProxy += ":"; - this->HTTPProxy += cmSystemTools::GetEnv("HTTP_PROXY_PORT"); + this->HTTPProxy += port; } - if (cmSystemTools::GetEnv("HTTP_PROXY_TYPE")) { - // this is the default - this->HTTPProxyType = CURLPROXY_HTTP; - std::string type = cmSystemTools::GetEnv("HTTP_PROXY_TYPE"); + std::string type; + if (cmSystemTools::GetEnv("HTTP_PROXY_TYPE", type)) { // HTTP/SOCKS4/SOCKS5 if (type == "HTTP") { this->HTTPProxyType = CURLPROXY_HTTP; @@ -238,12 +240,11 @@ void cmCTestCurl::SetProxyType() this->HTTPProxyType = CURLPROXY_SOCKS5; } } - if (cmSystemTools::GetEnv("HTTP_PROXY_USER")) { - this->HTTPProxyAuth = cmSystemTools::GetEnv("HTTP_PROXY_USER"); - } - if (cmSystemTools::GetEnv("HTTP_PROXY_PASSWD")) { + cmSystemTools::GetEnv("HTTP_PROXY_USER", this->HTTPProxyAuth); + std::string passwd; + if (cmSystemTools::GetEnv("HTTP_PROXY_PASSWD", passwd)) { this->HTTPProxyAuth += ":"; - this->HTTPProxyAuth += cmSystemTools::GetEnv("HTTP_PROXY_PASSWD"); + this->HTTPProxyAuth += passwd; } } } |