Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potentially false 'Illegal characters in header field name' error #936

Closed
sliekens opened this issue Jun 28, 2023 · 0 comments
Closed

Potentially false 'Illegal characters in header field name' error #936

sliekens opened this issue Jun 28, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@sliekens
Copy link

Describe the bug
Hello,

I'm having problems with headers containing a period (.) like X-DCC-scarlet.be-Metrics. I'm hitting this exception:

formatexception

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:

MimeKit/MimeKit/Header.cs

Lines 192 to 195 in 0913a82

for (int i = 0; i < field.Length; i++) {
if (field[i] >= 127 || !IsAsciiAtom ((byte) field[i]))
throw new ArgumentException ("Illegal characters in header field name.", nameof (field));
}

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.

@jstedfast jstedfast added the bug Something isn't working label Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants