Legacy bug in net/imap in Ruby 1.9.x

Hello

Since I'm using Rails 2.3.8 with Ruby 1.9.2 the sent emails are cut-off
at the end. Not always but only in non-multipart mails where the headers

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

apply to the content (in multipart mails Tmail makes the text/plain-part
have Content-Transfer-Encoding: Quoted-printable).

This fixes the problem:

module Net
  class IMAP
    def send_literal(str)
      put_string("{" + str.bytesize.to_s + "}" + CRLF)
      @continuation_request_arrival.wait
      raise @exception if @exception
      put_string(str)
    end
  end
end

The change is "str.length.to_s" -> "str.bytesize.to_s".

Regards, T.

···

--
Posted via http://www.ruby-forum.com/.

Will you file a ticket in the redmine tracker for this so that it gets
fixed in ruby-core?

  Ruby Issue Tracking System

Thanks.

···

On Fri, Jan 21, 2011 at 01:39:45AM +0900, T. N. T. wrote:

Hello

Since I'm using Rails 2.3.8 with Ruby 1.9.2 the sent emails are cut-off
at the end. Not always but only in non-multipart mails where the headers

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

apply to the content (in multipart mails Tmail makes the text/plain-part
have Content-Transfer-Encoding: Quoted-printable).

This fixes the problem:

module Net
  class IMAP
    def send_literal(str)
      put_string("{" + str.bytesize.to_s + "}" + CRLF)
      @continuation_request_arrival.wait
      raise @exception if @exception
      put_string(str)
    end
  end
end

The change is "str.length.to_s" -> "str.bytesize.to_s".

--
Aaron Patterson
http://tenderlovemaking.com/

Aaron Patterson wrote in post #977198:

Will you file a ticket in the redmine tracker for this so that it gets
fixed in ruby-core?

  Ruby Issue Tracking System

Thanks.

Done so (I must admit I've been too lazy):
http://redmine.ruby-lang.org/issues/show/4318

···

--
Posted via http://www.ruby-forum.com/\.