class Net::IMAP::ResponseParseError::InvalidTaggedResponseError
Error raised when the server sends a tagged response that is invalid for the command state.
This could be caused by a bug in the server or in Net::IMAP. Or it might indicate a malicious server, a man-in-the-middle attack, or client-side command injection, so the client should disconnect automatically and abruptly (without logout).
Attributes
The TaggedResponse which triggered this error
A symbol representing the state of the matching tagged command.
:unknown |
|
:unstarted |
Any tagged |
:incomplete |
A tagged |
:completed |
Multiple tagged responses were received for the same command. |
NOTE: Command state is neither anticipated nor remembered indefinitely. :unknown is used before the matching command is called and after the it is forgotten.
NOTE: This version of Net::IMAP does not detect or raise an exception for all of these states.
Public Class Methods
Source
# File lib/net/imap/errors.rb, line 333 def initialize(state, response:, command: nil) response => TaggedResponse[tag:, name: status] case [state, status, command] in :unknown, _, nil in :incomplete, "OK", {tag: ^tag, name:} in :unstarted | :completed, _, {tag: ^tag, name:} end @state, @command, @response = state, command, response cmd_desc = name ? "#{state} #{name}" : state super "Received tagged #{status} to #{cmd_desc} command (tag=#{tag})" rescue NoMatchingPatternError => err raise ArgumentError, err.message end
Public Instance Methods
Source
# File lib/net/imap/errors.rb, line 347 def detailed_message(**) "#{message}.\n" \ "Disconnecting: This could indicate a malicious server, a " \ "man-in-the-middle attack, a client-side command injection, or " \ "a bug in net-imap.\n" \ "response.data=#{response.data.inspect}" end