diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-04-02 14:19:45 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-04-02 14:19:45 (GMT) |
commit | 5ebcb51fb4b3f4ad6ce6933e3f166d3824cf9154 (patch) | |
tree | 549515efaf94dad5cb2ff56417248b34d0aa0fb3 /Source/cmCTest.cxx | |
parent | b60c9ae05ac501921060eb7f2b53e7d69e58cced (diff) | |
download | CMake-5ebcb51fb4b3f4ad6ce6933e3f166d3824cf9154.zip CMake-5ebcb51fb4b3f4ad6ce6933e3f166d3824cf9154.tar.gz CMake-5ebcb51fb4b3f4ad6ce6933e3f166d3824cf9154.tar.bz2 |
Url escape password
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r-- | Source/cmCTest.cxx | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 858ef41..3ee80e9 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -188,6 +188,33 @@ std::string cmCTest::MakeXMLSafe(const std::string& str) return ost.str(); } +std::string cmCTest::MakeURLSafe(const std::string& str) +{ + std::string::size_type pos = 0; + cmOStringStream ost; + char buffer[10]; + for ( pos = 0; pos < str.size(); pos ++ ) + { + unsigned char ch = str[pos]; + if ( ( ch > 126 || ch < 32 || + ch == '&' || + ch == '%' || + ch == '+' || + ch == '=' || + ch == '@' + ) && ch != 9 ) + { + sprintf(buffer, "%02x;", (unsigned int)ch); + ost << buffer; + } + else + { + ost << ch; + } + } + return ost.str(); +} + bool TryExecutable(const char *dir, const char *file, std::string *fullPath, const char *subdir) { @@ -1831,10 +1858,10 @@ int cmCTest::SubmitResults() { std::cout << "FTP submit method" << std::endl; std::string url = "ftp://"; - url += m_DartConfiguration["DropSiteUser"] + ":" + - m_DartConfiguration["DropSitePassword"] + "@" + + url += cmCTest::MakeURLSafe(m_DartConfiguration["DropSiteUser"]) + ":" + + cmCTest::MakeURLSafe(m_DartConfiguration["DropSitePassword"]) + "@" + m_DartConfiguration["DropSite"] + - m_DartConfiguration["DropLocation"]; + cmCTest::MakeURLSafe(m_DartConfiguration["DropLocation"]); if ( !submit.SubmitUsingFTP(m_ToplevelPath+"/Testing/"+m_CurrentTag, files, prefix, url) ) { |