diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-19 09:02:31 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-19 09:02:31 +0000 |
commit | 3f927dec87b53f733a2713d4c5351df0d88c774d (patch) | |
tree | c2c99110a1e0c2d05729a3c526e3c092cee3162d /lib/net | |
parent | 3c1b8a1b68f6309fbdb3d0e4be4e91c65c51386e (diff) |
* lib/net/imap.rb (body_type_msg): should accept
message/delivery-status with extra data.
[ruby-core:53741] [Bug #8167]
* test/net/imap/test_imap_response_parser.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/imap.rb | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb index a83f455163..f68fe4551e 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -2411,27 +2411,26 @@ module Net match(T_SPACE) param, content_id, desc, enc, size = body_fields - # If this is not message/rfc822, we shouldn't apply the RFC822 spec - # to it. - # We should handle anything other than message/rfc822 using - # multipart extension data [rfc3501] (i.e. the data itself won't be - # returned, we would have to retrieve it with BODYSTRUCTURE instead - # of with BODY - if "#{mtype}/#{msubtype}" != 'MESSAGE/RFC822' then - return BodyTypeExtension.new(mtype, msubtype, - param, content_id, - desc, enc, size) - end - - # Also, sometimes a message/rfc822 is included as a large - # attachment instead of having all of the other details - # (e.g. attaching a .eml file to an email) - token = lookahead - if token.symbol == T_RPAR then - return BodyTypeMessage.new(mtype, msubtype, param, content_id, - desc, enc, size, nil, nil, nil, nil, - nil, nil, nil) + if token.symbol == T_RPAR + # If this is not message/rfc822, we shouldn't apply the RFC822 + # spec to it. We should handle anything other than + # message/rfc822 using multipart extension data [rfc3501] (i.e. + # the data itself won't be returned, we would have to retrieve it + # with BODYSTRUCTURE instead of with BODY + + # Also, sometimes a message/rfc822 is included as a large + # attachment instead of having all of the other details + # (e.g. attaching a .eml file to an email) + if msubtype == "RFC822" + return BodyTypeMessage.new(mtype, msubtype, param, content_id, + desc, enc, size, nil, nil, nil, nil, + nil, nil, nil) + else + return BodyTypeExtension.new(mtype, msubtype, + param, content_id, + desc, enc, size) + end end match(T_SPACE) |