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

fix: Header parser (naive) #133

Merged
merged 2 commits into from
Sep 19, 2022
Merged

fix: Header parser (naive) #133

merged 2 commits into from
Sep 19, 2022

Conversation

jameshoulahan
Copy link
Contributor

The new header parser did not correctly deal with two edge cases:

  1. The message contains an embedded RFC822 message with no header
  2. Parsing something (not necessarily a header) with a key but no value

This fix checks that what we think is a header actually is one in a naive way by trying to parse it and seeing if it returns an error. It also handles the case that a header key was not finished being read by returning an error, indicating this wasn't a valid header).

rfc822/parser.go Outdated Show resolved Hide resolved
The new header parser did not correctly deal with two edge cases:
1. The message contains an embedded RFC822 message with no header
2. Parsing something (not necessarily a header) with a key but no value

This fix checks that what we think is a header actually is one in a
naive way by trying to parse it and seeing if it returns an error.
It also handles the case that a header key was not finished being read
by returning an error, indicating this wasn't a valid header).
@jameshoulahan jameshoulahan merged commit 38de1de into dev Sep 19, 2022
@jameshoulahan jameshoulahan deleted the fix/header-parser branch September 19, 2022 07:34
@github-actions
Copy link

🎉 This PR is included in version 0.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants