Class: Net::IMAP::BodyTypeAttachment
- Inherits:
-
Struct
- Object
- Struct
- Net::IMAP::BodyTypeAttachment
- Defined in:
- lib/net/imap/response_data.rb
Overview
BodyTypeAttachment is not used and will be removed in an upcoming release.
Bug Analysis
IMAP body structures are parenthesized lists and assign their fields positionally, so missing fields change the intepretation of all following fields. Additionally, different body types have a different number of required fields, followed by optional “extension” fields.
BodyTypeAttachment was previously returned when a “message/rfc822” part, which should be sent as body-type-msg
with ten required fields, was actually sent as a body-type-basic
with seven required fields.
basic => type, subtype, param, id, desc, enc, octets, md5=nil, dsp=nil, lang=nil, loc=nil, *ext
msg => type, subtype, param, id, desc, enc, octets, envelope, body, lines, md5=nil, ...
Normally, envelope
and md5
are incompatible, but Net::IMAP leniently allowed buggy servers to send NIL
for envelope
. As a result, when a server sent a message/rfc822
part with NIL
for md5
and a non-NIL
dsp
, Net::IMAP mis-interpreted the Content-Disposition
as if it were a strange body type. In all reported cases, the Content-Disposition
was “attachment”, so BodyTypeAttachment was created as the workaround.
Current behavior
When interpreted strictly, envelope
and md5
are incompatible. So the current parsing algorithm peeks ahead after it has recieved the seventh body field. If the next token is not the start of an envelope
, we assume the server has incorrectly sent us a body-type-basic
and return BodyTypeBasic. As a result, what was previously BodyTypeMessage#body => BodyTypeAttachment is now BodyTypeBasic#disposition => ContentDisposition.
Instance Attribute Summary collapse
-
#_unused_ ⇒ Object
Returns the value of attribute unused.
-
#dsp_type ⇒ Object
Returns the value of attribute dsp_type.
-
#param ⇒ Object
Returns the value of attribute param.
Instance Method Summary collapse
-
#media_type ⇒ Object
*invalid for BodyTypeAttachment*.
- #multipart? ⇒ Boolean
-
#subtype ⇒ Object
*invalid for BodyTypeAttachment*.
Instance Attribute Details
#_unused_ ⇒ Object
Returns the value of attribute unused
1018 1019 1020 |
# File 'lib/net/imap/response_data.rb', line 1018 def _unused_ @_unused_ end |
#dsp_type ⇒ Object
Returns the value of attribute dsp_type
1018 1019 1020 |
# File 'lib/net/imap/response_data.rb', line 1018 def dsp_type @dsp_type end |
#param ⇒ Object
Returns the value of attribute param
1018 1019 1020 |
# File 'lib/net/imap/response_data.rb', line 1018 def param @param end |
Instance Method Details
#media_type ⇒ Object
*invalid for BodyTypeAttachment*
1020 1021 1022 1023 1024 1025 |
# File 'lib/net/imap/response_data.rb', line 1020 def media_type warn(<<~WARN, uplevel: 1) BodyTypeAttachment#media_type is obsolete. Use dsp_type instead. WARN dsp_type end |
#multipart? ⇒ Boolean
1048 1049 1050 |
# File 'lib/net/imap/response_data.rb', line 1048 def multipart? return false end |
#subtype ⇒ Object
*invalid for BodyTypeAttachment*
1028 1029 1030 1031 |
# File 'lib/net/imap/response_data.rb', line 1028 def subtype warn("BodyTypeAttachment#subtype is obsolete.\n", uplevel: 1) nil end |