*** empty log message ***

svn path=/trunk/boinc/; revision=3560
This commit is contained in:
Rom Walton 2004-06-13 23:02:45 +00:00
parent fe17b414ef
commit 6f1b323f90
1 changed files with 14 additions and 1 deletions

View File

@ -403,16 +403,29 @@ inline void replace_string(
}
}
struct Tolower
{
Tolower (std::locale const& l) : loc(l) {;}
char operator() (char c) { return std::tolower(c,loc); }
private:
std::locale const& loc;
};
// Canonicalize a master url.
// - Convert the first part of a URL (before the "://") to lowercase
// - Remove double slashes
// - Add a trailing slash if necessary
//
void canonicalize_master_url(string& url) {
Tolower down ( std::locale("C") );
string::size_type p = url.find("://");
// lowercase http://
if (p != string::npos) {
transform(url.begin(), url.begin()+p, url.begin(), tolower);
transform(url.begin(), url.begin()+p, url.begin(), down);
p += 3;
} else {
p = 0;