Fix LIST/UIDL streaming parsing and reject zero message numbers#31
Open
Boomboomdunce wants to merge 6 commits intoDust-Mail:mainfrom
Open
Fix LIST/UIDL streaming parsing and reject zero message numbers#31Boomboomdunce wants to merge 6 commits intoDust-Mail:mainfrom
Boomboomdunce wants to merge 6 commits intoDust-Mail:mainfrom
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
RequestthroughPopStreamsoLISTandUIDLparsing no longer guesses from partial buffered bytesLIST/UIDLmessage numbers of0in both single-line and multi-line parser pathsRoot Cause
PopStreampreviously queued only a bareCommand, so the parser could not tell whetherLISTorUIDLhad been issued with an argument. In streaming reads, that meant a partial multi-line response like+OK 1 120\r\ncould be accepted as a valid single-line reply before the remaining lines arrived.Separately, the parser accepted
0as a valid POP3 message number inLISTandUIDLresponses even though POP3 message numbers are 1-based.This PR fixes both issues by preserving a
ResponseShapederived from the originalRequestfor the streaming path and by tighteningLIST/UIDLmessage-number validation.Test Plan
cargo test split_list_without_argument_still_parses_as_multilinecargo test split_uidl_without_argument_still_parses_as_multilinecargo test response::parser::test::test_listcargo test response::parser::test::test_uidlcargo test response::parser::test::test_list_rejects_zero_message_numbercargo test response::parser::test::test_uidl_rejects_zero_message_numbercargo test response::parser::cargo test dele_marks_message_as_deleted_locallycargo test --no-default-features --features runtime-tokio stream::tests::poll_next_returns_connection_closed_on_eofcargo test --no-default-features --features runtime-tokio stream::tests::buffer_accepts_messages_larger_than_twenty_megabytescargo test(fails only because the existing E2E tests requireSERVER,PORT,USERNAME, andPASSWORDin the environment)