Repository navigation
Fix CRLF encoding in EightBitStream - #130757
Merged
Merged
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates System.Net.Mime.EightBitStream (used by System.Net.Mail) to handle CRLF line endings correctly when \r and \n are split across separate Write calls, preserving SMTP dot-stuffing behavior at line boundaries.
Changes:
- Track whether the previous write ended with
\rand defer emitting it until the next byte is known. - Update line-ending detection to treat split
\r\nsequences as CRLF and reset line length correctly. - Add disposal-time handling to emit a trailing standalone
\rthat was deferred.
- Emit the deferred trailing CR in Close() before the underlying stream is closed. DelegatedStream.Close() closes the inner stream first, so writing in Dispose(bool) hit an already-closed stream. - Clarify the misleading 'seven bit data' comment in EncodeLines. - Add tests for CRLF split across writes and trailing-CR flush on sync/async disposal. Co-authored-by: Copilot <[email protected]> Copilot-Session: 0d67b329-86d5-4c3a-9694-aecd651258e3
DelegatedStream does not override DisposeAsync, so call base.DisposeAsync() after flushing the deferred CR to ensure the underlying stream is disposed in the async path, matching the synchronous Close() behavior. Co-authored-by: Copilot <[email protected]> Copilot-Session: 0d67b329-86d5-4c3a-9694-aecd651258e3
Member
Author
|
/ba-g CI failure is unrelated |
rzikm
enabled auto-merge (squash)
July 15, 2026 17:50
liveans
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Improve handling of CRLF line endings in the EightBitStream class. This change ensures that CR characters are correctly processed and written.