Project

General

Profile

Actions

Bug #4249

closed

Net::IMAP gets a parse error response while sending multibyte mail

Added by niw (Yoshimasa Niwa) over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]
Backport:
[ruby-core:34222]

Description

=begin
RFC3501 which defines IMAP version 4 rev 1 said:

"A literal is a sequence of zero or more octets (including CR and LF), prefix-quoted with an octet count
in the form of an open brace ("{"), the number of octets, close brace ("}"), and CRLF."

current imap.rb sends the number of characters not the octet count while sending String to server.

def send_literal(str)
put_string("{" + str.length.to_s + "}" + CRLF)
...
end

I've attached the code to reproduce the bug, and a small patch.
if Net::IMAP is designed that it expects ASCII-8BIT String, this may not a bug though.

Net::IMAPを使ってUTF-8などでエンコードされたメールを、例えばAPPENDする際に、
バイト数ではなく文字数を送ってしまうために期待しない返答が返ります。
もし、Net::IMAPが常にASCII-8BITの文字列を期待するのであれば、バグではないと思います。
=end


Files

imap_test.rb (480 Bytes) imap_test.rb niw (Yoshimasa Niwa), 01/07/2011 10:06 PM
imap.rb.patch (784 Bytes) imap.rb.patch niw (Yoshimasa Niwa), 01/07/2011 10:06 PM
Actions #1

Updated by naruse (Yui NARUSE) over 13 years ago

  • Status changed from Open to Assigned
  • Assignee set to shugo (Shugo Maeda)

=begin

=end

Actions #2

Updated by naruse (Yui NARUSE) over 13 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r30543.
Yoshimasa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

  • lib/net/imap.rb: use bytesize for binary strings.
    patched by Yoshimasa Niwa. [ruby-core:34222]
    =end
Actions

Also available in: Atom PDF

Like0
Like0Like0