script output fields is checked for duplicate

This commit is contained in:
hugogogo
2022-08-12 11:45:06 +02:00
parent 3a58b5d921
commit c225063361
5 changed files with 22 additions and 5 deletions

View File

@@ -267,7 +267,8 @@ size_t
err++;
continue;
}
key = ::str_tolower(key); // to make "key" case_insensitive
// bad idea, in cgi we need to have the original value
// key = ::str_tolower(key); // to make "key" case_insensitive
val = (*it).substr(pos + 1);
val = ::trim(val, ' ');
fields.insert( std::pair<std::string, std::string>(key, val) );
@@ -275,6 +276,23 @@ size_t
return err;
}
void str_map_key_tolower(std::map<std::string, std::string> & mp)
{
std::map<std::string, std::string> new_mp;
std::map<std::string, std::string>::iterator it;
std::string key;
std::string value;
for (it = mp.begin(); it != mp.end(); it++)
{
key = it->first;
value = it->second;
key = ::str_tolower(key);
new_mp.insert( std::pair<std::string, std::string>(key, value) );
}
mp.swap(new_mp);
}
// DEBUG
void print_special(std::string str)
{