123456789_123456789_123456789_123456789_123456789_

Class: Net::IMAP::BodyTypeAttachment

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, BodyStructure, Struct
Inherits: Struct
  • Object
Defined in: lib/net/imap/response_data.rb

Overview

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.

Instance Attribute Summary

  • #_unused_ rw

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

  • #dsp_type rw

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

  • #multipart? ⇒ Boolean readonly
  • #param rw

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

Instance Method Summary

Instance Attribute Details

#_unused_ (rw)

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.

[ GitHub ]

  
# File 'lib/net/imap/response_data.rb', line 1156

class BodyTypeAttachment < Struct.new(:dsp_type, :_unused_, :param)

#dsp_type (rw)

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.

[ GitHub ]

  
# File 'lib/net/imap/response_data.rb', line 1156

class BodyTypeAttachment < Struct.new(:dsp_type, :_unused_, :param)

#multipart?Boolean (readonly)

[ GitHub ]

  
# File 'lib/net/imap/response_data.rb', line 1188

def multipart?
  return false
end

#param (rw)

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.

[ GitHub ]

  
# File 'lib/net/imap/response_data.rb', line 1156

class BodyTypeAttachment < Struct.new(:dsp_type, :_unused_, :param)

Instance Method Details

#media_type

*invalid for BodyTypeAttachment*

[ GitHub ]

  
# File '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

#subtype

*invalid for BodyTypeAttachment*

[ GitHub ]

  
# File 'lib/net/imap/response_data.rb', line 1168

def subtype
  warn("BodyTypeAttachment#subtype is obsolete.\n", uplevel: 1)
  nil
end