Potentially false 'Illegal characters in header field name' error #936
Description
Describe the bug
Hello,
I'm having problems with headers containing a period (.
) like X-DCC-scarlet.be-Metrics
. I'm hitting this exception:
I glanced at the ABNF grammar for header names and If I'm not mistaken, periods should be allowed?
The error should be thrown by the following code:
Lines 192 to 195 in 0913a82
Platform (please complete the following information):
- OS: [e.g. Windows, Linux, MacOS, iOS, Android, Windows Phone, etc.] Debian 11
- .NET Runtime: [e.g. CoreCLR, Mono] CoreCLR
- .NET Framework: [e.g. .Net Core, .NET 4.5, UWP, etc.] .NET 6
- MimeKit Version: 4.1.0
Expected behavior
I think it should be possible to create an instance of Header
even if it contains a period.
Code Snippets
var header = new MimeKit.Header("X-DCC-scarlet.be-Metrics", "whatever");
Additional context
For context: this is a header used by a Belgian internet service provider, https://www.scarlet.be. I guess they add headers like this for their own telemetry.
My use case is converting Outlook MSG files that contain this header to Mime messages.