automatic: Translate end-of-lines in email emitter by DNF #2010
+22
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The fix in 9a5cba8 (automatic: Fix end-of-lines in messages sent by email emitter) utilized cURL library for translating LF ending to CR-LF in content of SMTP DATA command. It fixed the problem with curl-8.11.1, but broke end-of-lines in e-mail headers with old curl-8.9.1.
I was unable to find what has changed in cURL, but the cause was that automatic plugin already separated headers by CR-LF, therefore cURL probably double-encoded them and that was again rejected by sendmail 8.18.1.
This patch reverts 9a5cba8 and instead performs the end-of-line normalization fully in dnf5::EmailMessage::str() method. Now the output of the method is completely valid e-mail message.
Implementation detail: I changed dnf5::Emitter::output_stream variable from const to non-cost to be able to call getline() on it. If is a problem, I will need to come with a more complicated solution because I can only obtain a new-line delimiter used in the std::stringstream object by getline().
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2335508