Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: Tero Tilus <tero@tilus.net>
To: sup-talk@rubyforge.org
Subject: [sup-talk] RMail chokes on broken headers
Date: Tue, 13 Oct 2009 02:22:15 +0300	[thread overview]
Message-ID: <20091012232215.GD31940@tilus.net> (raw)

RMail::Header#content_type breaks when it encounters broken
Content-Type and takes sup-sync down with it

/usr/lib/ruby/gems/1.8/gems/rmail-1.0.0/lib/rmail/header.rb:537:in `content_type': undefined method `downcase' for nil:NilClass (NoMethodError)
        from /home/terotil/src/sup/lib/sup/message.rb:439:in `message_to_chunks'
        from /home/terotil/src/sup/lib/sup/message.rb:239:in `load_from_source!'
        from /home/terotil/src/sup/lib/sup/message.rb:335:in `build_from_source'
        from /home/terotil/src/sup/lib/sup/poll.rb:160:in `each_message_from'

Worked around it this way

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index f9f87de..5ff3e48 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -436,7 +436,7 @@ private
       end
 
       chunks
-    elsif m.header.content_type && m.header.content_type.downcase == "message/rfc822"
+    elsif (m.header.content_type == "message/rfc822" rescue false) # rmail 1.0.0 may choke on broken content-type header, FIXME: fix rmail
       if m.body
         payload = RMail::Parser.read(m.body)
         from = payload.header.from.first ? payload.header.from.first.format : ""
@@ -456,7 +456,7 @@ private
         debug "no body for message/rfc822 enclosure; skipping"
         []
       end
-    elsif m.header.content_type && m.header.content_type.downcase == "application/pgp" && m.body
+    elsif (m.header.content_type.downcase == "application/pgp" rescue false) && m.body # rmail 1.0.0 may choke on broken content-type header, FIXME: fix rmail
       ## apparently some versions of Thunderbird generate encryped email that
       ## does not follow RFC3156, e.g. messages with X-Enigmail-Version: 0.95.0
       ## they have no MIME multipart and just set the body content type to

The problem itself is inside RMail.  I reported it.
http://rubyforge.org/tracker/index.php?func=detail&aid=27282&group_id=446&atid=1754

RMail looks abandoned.  Development is pretty much stalled.  No
functional changes since 2004-04-27.  None of the reported bugs have
been fixed.  Might it be worth to think about switching to another
mail lib?  TMail author's http://github.com/mikel/mail/ looks
promising.

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk


             reply	other threads:[~2009-10-12 23:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-12 23:22 Tero Tilus [this message]
2009-10-15 13:11 ` William Morgan
2009-10-29 23:02   ` Mariano Mara
2009-10-30 21:50     ` William Morgan
2009-10-31 20:18       ` Mariano Mara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091012232215.GD31940@tilus.net \
    --to=tero@tilus.net \
    --cc=sup-talk@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox