net.smtp: correct From/To/Cc/Bcc headers and address normalization - #28262
net.smtp: correct From/To/Cc/Bcc headers and address normalization#28262nunsez wants to merge 5 commits into
Conversation
|
I’d request changes on PR #28262. The overall direction—separating SMTP envelope addresses from RFC 5322 header formatting—is good, but I found two correctness regressions in the new mailbox parser.
The tests otherwise cover the common cases well—plain addresses, display names, Unicode names, semicolon-separated recipients, and envelope normalization. The targeted I haven’t posted anything to GitHub. If you want, I can turn the first two findings into concise inline review comments and submit a Request changes review. I can also keep an eye on the PR for fixes or new CI results. |
|
Thank you for the thorough review and for taking the time to point out the weak spots. |
|
I would also suggest merging main into this PR, to (hopefully) cut down the CI errors. |
df331b5 to
d0f4fcb
Compare
|
Fixed |
|
Re-reviewed the updated head Your three previous blockers are fixed correctly:
Also, correction to something I mentioned while reviewing: I found one remaining P2 in the CRLF hardening, though:
open_at := index_unquoted(trimmed, `<`, 0) or {
return none, trimmed
}That means a bare value such as: can still put a newline into The simplest fix is to sanitize before branching: trimmed := strip_crlf(s.trim_space())and then remove/reduce the later duplicate stripping. I'd add one bare-address CRLF regression test for both There is also still a CI blocker: the current head has So my current verdict is request changes for the bare-address CRLF path + get formatting CI green. After those, I’d be comfortable approving. |
78acc11 to
3630fb9
Compare

Problem
In Mail.message_data the From, To, Cc and Bcc headers were built from fixed raw strings:
Because of this:
What was done
Note on formatting noise
I ran
./vnew fmt -won the touched files after implementing the logic, so the diff also contains some alignment changes (struct field spacing etc.) that just come from the formatter, not from the fix itself.