--- a/src/XMLDocumentConstructor.h Sat Feb 06 20:24:55 2021 +0100
+++ b/src/XMLDocumentConstructor.h Sat Feb 06 20:32:26 2021 +0100
@@ -55,6 +55,12 @@
return contentType.getType() + "/" + contentType.getSubType();
}
+ std::string toLowerCase(const std::string& value) {
+ std::string result = value;
+ std::transform(result.begin(), result.end(), result.begin(), ::tolower);
+ return result;
+ }
+
std::string fetchBody(std::shared_ptr<vmime::body> body) {
std::stringstream result;
vmime::utility::outputStreamAdapter resultAdapter(result);
@@ -121,9 +127,7 @@
for (std::shared_ptr<vmime::headerField> mimeField : m.getHeader()->getFieldList()) {
// TODO: Are names always ASCII and subset of UTF-8?
- // TODO: Convert header names to lower case? (they should be case insensitive)
- xmlpp::Element* field = headers->add_child(nameCodec.encode(mimeField->getName()));
-
+ xmlpp::Element* field = headers->add_child(toLowerCase(nameCodec.encode(mimeField->getName())));
if (auto value = mimeField->getValue<vmime::text>()) {
field->add_child_text(value->getConvertedText(ch));