ENH: Add support for proxy authentication (thanks Jean-Michel)

This commit is contained in:
Andy Cedilnik 2004-11-24 09:25:32 -05:00
parent 67111942c0
commit a0c96218b0
2 changed files with 22 additions and 1 deletions

View File

@ -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());
}
}
}

View File

@ -64,6 +64,7 @@ public:
private:
cmStdString m_HTTPProxy;
int m_HTTPProxyType;
cmStdString m_HTTPProxyAuth;
cmStdString m_FTPProxy;
int m_FTPProxyType;
bool m_Verbose;