Skip to content
New issue

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

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

Already on GitHub? # to your account

RFC2231 header parameter-value encoding #311

Merged
merged 1 commit into from
Jan 30, 2023

Conversation

Maria-12648430
Copy link
Contributor

As pointed out in #310, parameters are supposed to be encoded according to RFC2231, not RFC2047.

The value is first analyzed to decide which representation can/must be used, based on the presence of CTLs, spaces, tspecials, and UTF-8 multibyte characters. Then it is encoded in the selected representation. If the parameter lines become too long (>76 bytes), they are split up according to the continuation scheme described in RFC2231.

In hindsight, getting this right was surprisingly difficult, and therefore a careful review seems to be called for.

@seriyps
Copy link
Collaborator

seriyps commented Feb 22, 2022

Was surprized it did not trigger proper test failure, but it seems we don't generate long or non-ascii header parameter values.

header_name()

Might be nice to update when parser part is also implemented.

I'll have a deeper look bit later today, thank you!

@Maria-12648430
Copy link
Contributor Author

Last commit takes care of an edge case: invalid UTF-8 sequences were not encoded but left as-is.
Also added specs.

@mworrell
Copy link
Collaborator

mworrell commented Apr 8, 2022

@seriyps Ok to merge this?

@arjan arjan mentioned this pull request Apr 8, 2022
@seriyps
Copy link
Collaborator

seriyps commented Dec 22, 2022

Great work! Sorry for the delay, it was due to UA-RU war.

@Maria-12648430
Copy link
Contributor Author

@seriyps thanks 😄 TBH, I totally forgot about this one 😅

src/mimemail.erl Outdated Show resolved Hide resolved
Co-authored-by: Jan Uhlig <juhlig@hnc-agency.org>
@mworrell
Copy link
Collaborator

@seriyps I am ok with this being merged.

@arjan arjan merged commit cd39485 into gen-smtp:master Jan 30, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants