Skip to content

IMAP: Multiple bugs #196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merging in changes from topic/imap_speed_improvements, from 40a2902 to
  • Loading branch information
tonyarkles committed Oct 12, 2012
commit f17ed14e967e9b49db443d2d3882cad51b4dd51d
21 changes: 21 additions & 0 deletions lib/net/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,14 @@ def media_subtype
end
end

class BodyTypeExtension < Struct.new(:media_type, :subtype,
:params, :content_id,
:description, :encoding, :size)
def multipart?
return false
end
end

class ResponseParser # :nodoc:
def initialize
@str = nil
Expand Down Expand Up @@ -2403,6 +2411,19 @@ def body_type_msg
mtype, msubtype = media_type
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

match(T_SPACE)
env = envelope
match(T_SPACE)
Expand Down
13 changes: 13 additions & 0 deletions test/net/imap/test_imap_response_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,17 @@ def test_body_type_attachment
assert_equal("Fw_ ____ _____ ____.eml",
response.data.attr["BODYSTRUCTURE"].parts[1].body.param["FILENAME"])
end

def assert_parseable(s)
parser = Net::IMAP::ResponseParser.new
parser.parse(s.gsub(/\n/, "\r\n").taint)
end

def test_msg_delivery_status
# This was part of a larger response that caused crashes, but this was the
# minimal test case to demonstrate it
assert_parseable <<EOF
* 4902 FETCH (BODY (("MESSAGE" "DELIVERY-STATUS" NIL NIL NIL "7BIT" 324) "REPORT"))
EOF
end
end
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy