Case-insensitive MIME headers

This commit is contained in:
François 2024-02-11 16:06:02 +01:00
parent 033c497d41
commit 511e14785b
2 changed files with 18 additions and 5 deletions

View File

@ -297,10 +297,23 @@ Attachment::Attachment (ifstream &mbox, const int &level, const streamoff beginI
// ================================================================================ // ================================================================================
inline string inline string
cleanString (const string &line) { cleanString (string line) {
static const regex findVarVal ("(\\s*[a-zA-Z_*-]+=)((\"(\\\\.|[^\\\\])*\")|[^; \t]*;?)");
string result;
smatch m;
while (regex_search (line, m, findVarVal)) {
result += m.prefix ();
string id (m[1]);
toLower (id);
result += id;
result += m[2];
line = m.suffix ();
}
if (!line.empty () && line[line.size() - 1] == '\r') if (!line.empty () && line[line.size() - 1] == '\r')
return line.substr (0, line.size () - 1); line = line.substr (0, line.size () - 1);
return line; result += line;
return result;
} }
void void

View File

@ -33,8 +33,8 @@
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
#include "version.hpp" #include "version.hpp"
const std::string kaz::LAST_VERSION_NUM ("2.18"); const std::string kaz::LAST_VERSION_NUM ("2.19");
const std::string kaz::LAST_VERSION_DATE ("2023-10-29"); const std::string kaz::LAST_VERSION_DATE ("2024-02-11");
const std::string kaz::LAST_VERSION (LAST_VERSION_NUM+" "+LAST_VERSION_DATE+" eMailShrinker"); const std::string kaz::LAST_VERSION (LAST_VERSION_NUM+" "+LAST_VERSION_DATE+" eMailShrinker");
#include <iostream> #include <iostream>