Skip to content

Return the unique ID from single-message UIDL replies - #33

Open
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/uidl-pop
Open

Return the unique ID from single-message UIDL replies#33
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/uidl-pop

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Return the unique ID, rather than the message number, from a single-message UIDL reply. A reply is +OK message-number unique-id; the current parser returns the second token. Use whitespace splitting and take the third token, retaining the ID's case and bytes.

Reproduction

require 'net/pop'
socket = Object.new
socket.instance_variable_set(:@responses, ['+OK fixture', '+OK 2 QhdPYR:00WBw1Ph7x7'])
def socket.readline = @responses.shift
def socket.writeline(*) = nil
command = Net::POP3Command.new(socket)
p command.uidl(2)
# Before: "2"
# After:  "QhdPYR:00WBw1Ph7x7"

This follows the single-message UIDL example in RFC 1939 section 7.

Verification

  • 148 focused checks, including a bounded real localhost session: message numbers, punctuation, mixed case, one-/70-character IDs, whitespace, transmitted commands, negative replies and session cleanup. Before: 97 failed expectations; after: zero.
  • 200 additional checks retain multiline UIDL/LIST behavior across every split point of the sample replies, including CR/LF boundaries and byte-at-a-time input. These pass before and after with net-protocol 0.3.0 and the consumer's existing protocol fixes.
  • Existing suite on baseline and isolated patch: 10 tests / 17 assertions / zero failures/errors, Ruby 4.0.6 via rbenv. Syntax and git diff --check pass; supplemental lint was compared with baseline.
  • No repository tests, dependencies, workflow settings or unrelated source changed. Reproduction/check scripts are external under the consumer repository's no-new-tests policy.

Compatibility and limits

No API signature change. The internal POP3Command#uidl(number) intentionally returns the correct ID instead of a message number; callers relying on the wrong value will observe a change. The multiline path used by POPMail#unique_id is unchanged. No new strict malformed-response validation is introduced.

This is separate from issue #27's reported multiline chunk loss. That issue did not reproduce in the bounded current-reader checks above; this PR does not claim to resolve it. Other Ruby/OS runtimes and external mail providers were not tested; no production or external mailbox access occurred.

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