class Net::IMAP::BodyTypeAttachment

WARNING

BodyTypeAttachment represents a body-fld-dsp that is incorrectly in a position where the IMAP4rev1 grammar expects a nested body structure.

IMAP body structures are parenthesized lists and assign their fields positionally, so missing fields change the intepretation of all following fields. Buggy IMAP servers sometimes leave fields missing rather than empty, which inevitably confuses parsers. BodyTypeAttachment was an attempt to parse a common type of buggy body structure without crashing.

Currently, when Net::IMAP::ResponseParser sees “attachment” as the first entry in a body-type-1part, which is where the MIME type should be, it uses BodyTypeAttachment to capture the rest. “attachment” is not a valid MIME type, but is a common Content-Disposition. What might have happened was that buggy server could not parse the message (which might have been incorrectly formatted) and output a body-type-dsp where a Net::IMAP::ResponseParser expected to see a body.

A future release will replace this, probably with a ContentDisposition nested inside another body structure object, maybe BodyTypeBasic, or perhaps a new body structure class that represents any unparsable body structure.

Public Instance Methods

dsp_type → string click to toggle source

Returns the content disposition type, as defined by [DISPOSITION].

# File net-imap-0.3.7/lib/net/imap/response_data.rb, line 1174
      
media_type() click to toggle source

*invalid for BodyTypeAttachment*

# File net-imap-0.3.7/lib/net/imap/response_data.rb, line 1160
      def media_type
        warn(<<~WARN, uplevel: 1)
          BodyTypeAttachment#media_type is obsolete.  Use dsp_type instead.
        WARN
        dsp_type
      end
multipart?() click to toggle source
# File net-imap-0.3.7/lib/net/imap/response_data.rb, line 1188
def multipart?
  return false
end
param → hash click to toggle source

Returns a hash representing parameters of the Content-Disposition field, as defined by [DISPOSITION].

# File net-imap-0.3.7/lib/net/imap/response_data.rb, line 1181
      
subtype() click to toggle source

*invalid for BodyTypeAttachment*

# File net-imap-0.3.7/lib/net/imap/response_data.rb, line 1168
def subtype
  warn("BodyTypeAttachment#subtype is obsolete.\n", uplevel: 1)
  nil
end