Skip to content

Fix LIST/UIDL streaming parsing and reject zero message numbers#31

Open
Boomboomdunce wants to merge 6 commits intoDust-Mail:mainfrom
Boomboomdunce:fix/pop3-response-shape
Open

Fix LIST/UIDL streaming parsing and reject zero message numbers#31
Boomboomdunce wants to merge 6 commits intoDust-Mail:mainfrom
Boomboomdunce:fix/pop3-response-shape

Conversation

@Boomboomdunce
Copy link
Copy Markdown
Contributor

@Boomboomdunce Boomboomdunce commented Mar 27, 2026

Summary

  • preserve the expected POP3 response shape from Request through PopStream so LIST and UIDL parsing no longer guesses from partial buffered bytes
  • reject invalid LIST/UIDL message numbers of 0 in both single-line and multi-line parser paths
  • add chunked-stream regression tests for split multi-line responses plus parser tests for illegal zero message numbers

Root Cause

PopStream previously queued only a bare Command, so the parser could not tell whether LIST or UIDL had been issued with an argument. In streaming reads, that meant a partial multi-line response like +OK 1 120\r\n could be accepted as a valid single-line reply before the remaining lines arrived.

Separately, the parser accepted 0 as a valid POP3 message number in LIST and UIDL responses even though POP3 message numbers are 1-based.

This PR fixes both issues by preserving a ResponseShape derived from the original Request for the streaming path and by tightening LIST/UIDL message-number validation.

Test Plan

  • cargo test split_list_without_argument_still_parses_as_multiline
  • cargo test split_uidl_without_argument_still_parses_as_multiline
  • cargo test response::parser::test::test_list
  • cargo test response::parser::test::test_uidl
  • cargo test response::parser::test::test_list_rejects_zero_message_number
  • cargo test response::parser::test::test_uidl_rejects_zero_message_number
  • cargo test response::parser::
  • cargo test dele_marks_message_as_deleted_locally
  • cargo test --no-default-features --features runtime-tokio stream::tests::poll_next_returns_connection_closed_on_eof
  • cargo test --no-default-features --features runtime-tokio stream::tests::buffer_accepts_messages_larger_than_twenty_megabytes
  • cargo test (fails only because the existing E2E tests require SERVER, PORT, USERNAME, and PASSWORD in the environment)

@Boomboomdunce Boomboomdunce changed the title Fix LIST/UIDL parsing for split multi-line POP3 responses Fix LIST/UIDL streaming parsing and reject zero message numbers Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant