-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
MessageDeliveryStatus accessors throws "Failed to parse headers." if content doesn't end with a blank line #250
Comments
…t end with a blank line Fixes issue #250
This should be fixed now in git master. |
Thanks! |
No prob, thanks for reporting this bug :) |
I have published a new version of MimeKit that fixes this issue to nuget |
@jstedfast after upgrading MailKit from 2.15 to latest 3.1.0 we started getting the same `Failed to parse headers" exception when trying to access "StatusGroups"
For messages that worked fine previously. |
Okay, I'll take a look |
@jitbit oddly I'm not getting an error if I modify the MessageDeliveryStatusTests.TestMimeParser() test data (aka delivery-status.txt) to remove the blank line at the end of the message/delivery-status part (before the rfc822 part). Can you provide a sample that breaks? |
I'm not 100% sure it's caused by line breaks or even connected to the original issue. But here's the .eml that breaks things: It's a standard bounce message sent by Outlook 365 It has a delivery status report in it, and here's the code that breaks:
|
@jitbit I think I see the problem. It looks like the message/delivery-status contains content other than status groups (specifically, it contains 1 set of status-group headers and base64 content). I'll take a look tonight at the spec (in case I missed something) and at figuring out a solution. Even if it's not legal, being that it's such a widely used server, it probably needs a work-around at least. |
@jstedfast thanks a ton! Yes, it's pretty widely used, and we're getting reports like that every hour basically. P.S. The error was not thrown in 2.15 |
@alex-jitbit I've successfully confirmed the "Cannot parse headers" exception. |
@alex-jitbit is it ok if I end up including your test message as a unit test in MimeKit? Or should I try to scrub anything? The issue is that the message/delivery-status content should be multiple blocks of headers (aka status groups), but after the first status group of headers, it's base64-encoded. Turns out the base64-encoded blob is the second status group of headers. I've got a work-around that checks if the first status group of headers contains a Content-Transfer-Encoding, and if so, passes the remainder of the data thru a base64 decoder to parse the rest. |
@jstedfast sure, please do |
…encoded status groups Fixes a followup bug report in issue #250
Should be fixed now in the myget builds. If you need me to, I'll make a new release probably tomorrow night. |
@jstedfast Thanks for the quick fix!! Yeah, a nuget update would be much appreciated, thanks for that too |
Just released 3.1.1 with this fix. |
When the last status group in a message/delivery-status MIME part does not end with a blank line the
MimeParser
throws an "Failed to parse headers." exception when calling theMessageDeliveryStatus.StatusGroups
property.The text was updated successfully, but these errors were encountered: