Skip to content

🥅 Guard against tagged responses sent too soon#690

Open
nevans wants to merge 1 commit into
masterfrom
guard-other-premature-tagged-responses
Open

🥅 Guard against tagged responses sent too soon#690
nevans wants to merge 1 commit into
masterfrom
guard-other-premature-tagged-responses

Conversation

@nevans
Copy link
Copy Markdown
Collaborator

@nevans nevans commented Jun 5, 2026

The premature tagged response guard that was added for #644 only checked for premature OK, not for premature BAD or NO. When those are detected prior to the tag being sent, this treats those cases as the same sort of error.

Note that this explicitly raises a "closed stream" IOError when disconnected. This is the error that would be raised anyway, if send_command were allowed to write to the connection. But, if we can test that the socket is already closed, we can raise the error directly. There's no need to attempt to format and send data. A future version will probably change this to raise a different error (subclass of Net::IMAP::Error) instead.

The premature tagged response guard that was added for #644 only checked
for premature `OK`, not for premature `BAD` or `NO`.  When those are
detected prior to the tag being sent, this treats those cases as the
same sort of error.

Note that this explicitly raises a "closed stream" IOError when
disconnected.  This is the error that would be raised anyway, if
`send_command` were allowed to write to the connection.  But, if we can
test that the socket is already closed, we can raise the error directly.
There's no need to attempt to format and send data.
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