[前][次][番号順一覧][スレッド一覧]

ruby-changes:23005

From: shugo <ko1@a...>
Date: Fri, 16 Mar 2012 13:56:29 +0900 (JST)
Subject: [ruby-changes:23005] shugo:r35054 (trunk): * lib/net/imap.rb (rfc822_text): ignore [] after RFC822.

shugo	2012-03-16 13:56:18 +0900 (Fri, 16 Mar 2012)

  New Revision: 35054

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35054

  Log:
    * lib/net/imap.rb (rfc822_text): ignore [] after RFC822.
      [ruby-core:40945] [Bug #5620]

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/imap.rb
    trunk/test/net/imap/test_imap_response_parser.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 35053)
+++ ChangeLog	(revision 35054)
@@ -1,3 +1,8 @@
+Fri Mar 16 13:50:12 2012  Shugo Maeda  <shugo@r...>
+
+	* lib/net/imap.rb (rfc822_text): ignore [] after RFC822.
+	  [ruby-core:40945] [Bug #5620]
+
 Fri Mar 16 12:00:42 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm_insnhelper.c (argument_error): use line number at the beginning
Index: lib/net/imap.rb
===================================================================
--- lib/net/imap.rb	(revision 35053)
+++ lib/net/imap.rb	(revision 35054)
@@ -2281,6 +2281,11 @@
       def rfc822_text
         token = match(T_ATOM)
         name = token.value.upcase
+        token = lookahead
+        if token.symbol == T_LBRA
+          shift_token
+          match(T_RBRA)
+        end
         match(T_SPACE)
         return name, nstring
       end
Index: test/net/imap/test_imap_response_parser.rb
===================================================================
--- test/net/imap/test_imap_response_parser.rb	(revision 35053)
+++ test/net/imap/test_imap_response_parser.rb	(revision 35054)
@@ -126,4 +126,20 @@
     }
     assert_match(/ for \{123\}/, e.message)
   end
+
+  def test_msg_att_rfc822_text
+    parser = Net::IMAP::ResponseParser.new
+    response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
+* 123 FETCH (RFC822 {5}
+foo
+)
+EOF
+    assert_equal("foo\r\n", response.data.attr["RFC822"])
+    response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
+* 123 FETCH (RFC822[] {5}
+foo
+)
+EOF
+    assert_equal("foo\r\n", response.data.attr["RFC822"])
+  end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]