ENH: Add support for proxy authentication (thanks Jean-Michel)
This commit is contained in:
parent
67111942c0
commit
a0c96218b0
|
@ -27,6 +27,7 @@ cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
|
|||
m_Verbose = false;
|
||||
m_HTTPProxy = "";
|
||||
m_HTTPProxyType = 0;
|
||||
m_HTTPProxyAuth = "";
|
||||
if ( getenv("HTTP_PROXY") )
|
||||
{
|
||||
m_HTTPProxyType = 1;
|
||||
|
@ -53,6 +54,15 @@ cmCTestSubmit::cmCTestSubmit() : m_HTTPProxy(), m_FTPProxy()
|
|||
m_HTTPProxyType = 3;
|
||||
}
|
||||
}
|
||||
if ( getenv("HTTP_PROXY_USER") )
|
||||
{
|
||||
m_HTTPProxyAuth = getenv("HTTP_PROXY_USER");
|
||||
}
|
||||
if ( getenv("HTTP_PROXY_PASSWD") )
|
||||
{
|
||||
m_HTTPProxyAuth += ":";
|
||||
m_HTTPProxyAuth += getenv("HTTP_PROXY_PASSWD");
|
||||
}
|
||||
}
|
||||
m_FTPProxy = "";
|
||||
m_FTPProxyType = 0;
|
||||
|
@ -224,6 +234,11 @@ bool cmCTestSubmit::SubmitUsingHTTP(const cmStdString& localprefix,
|
|||
break;
|
||||
default:
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
|
||||
if (m_HTTPProxyAuth.size() > 0)
|
||||
{
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
|
||||
m_HTTPProxyAuth.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,6 +364,11 @@ bool cmCTestSubmit::TriggerUsingHTTP(const std::vector<cmStdString>& files,
|
|||
break;
|
||||
default:
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
|
||||
if (m_HTTPProxyAuth.size() > 0)
|
||||
{
|
||||
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD,
|
||||
m_HTTPProxyAuth.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ public:
|
|||
private:
|
||||
cmStdString m_HTTPProxy;
|
||||
int m_HTTPProxyType;
|
||||
cmStdString m_HTTPProxyAuth;
|
||||
cmStdString m_FTPProxy;
|
||||
int m_FTPProxyType;
|
||||
bool m_Verbose;
|
||||
|
|
Loading…
Reference in New Issue