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

ruby-changes:50015

From: usa <ko1@a...>
Date: Wed, 31 Jan 2018 20:47:55 +0900 (JST)
Subject: [ruby-changes:50015] usa:r62133 (ruby_2_3): merge revision(s) 60021: [Backport #13926]

usa	2018-01-31 20:47:49 +0900 (Wed, 31 Jan 2018)

  New Revision: 62133

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62133

  Log:
    merge revision(s) 60021: [Backport #13926]
    
    HTTPHeader#add_field should allow binary [Bug #13926]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/lib/net/http/header.rb
    branches/ruby_2_3/test/net/http/test_httpheader.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 62132)
+++ ruby_2_3/version.h	(revision 62133)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.7"
 #define RUBY_RELEASE_DATE "2018-01-31"
-#define RUBY_PATCHLEVEL 394
+#define RUBY_PATCHLEVEL 395
 
 #define RUBY_RELEASE_YEAR 2018
 #define RUBY_RELEASE_MONTH 1
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 62132)
+++ ruby_2_3/ChangeLog	(revision 62133)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Wed Jan 31 20:47:07 2018  NARUSE, Yui  <naruse@r...>
+
+	HTTPHeader#add_field should allow binary [Bug #13926]
+
 Wed Jan 31 20:42:11 2018  Marcus Stollsteimer  <sto.mar@w...>
 
 	ri.1: rewrite ri man page
Index: ruby_2_3/lib/net/http/header.rb
===================================================================
--- ruby_2_3/lib/net/http/header.rb	(revision 62132)
+++ ruby_2_3/lib/net/http/header.rb	(revision 62133)
@@ -72,7 +72,7 @@ module Net::HTTPHeader https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/net/http/header.rb#L72
       @header[key.downcase] = ary
     else
       val = val.to_s
-      if /[\r\n]/ =~ val
+      if /[\r\n]/n =~ val.b
         raise ArgumentError, 'header field value cannnot include CR/LF'
       end
       @header[key.downcase] = [val]
@@ -85,7 +85,7 @@ module Net::HTTPHeader https://github.com/ruby/ruby/blob/trunk/ruby_2_3/lib/net/http/header.rb#L85
       val.each{|x| append_field_value(ary, x)}
     else
       val = val.to_s
-      if /[\r\n]/ =~ val
+      if /[\r\n]/n =~ val.b
         raise ArgumentError, 'header field value cannnot include CR/LF'
       end
       ary.push val
Index: ruby_2_3/test/net/http/test_httpheader.rb
===================================================================
--- ruby_2_3/test/net/http/test_httpheader.rb	(revision 62132)
+++ ruby_2_3/test/net/http/test_httpheader.rb	(revision 62133)
@@ -45,6 +45,9 @@ class HTTPHeaderTest < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/net/http/test_httpheader.rb#L45
     assert_equal 2, @c.length
     assert_equal ['aaa', 'bbb', '3'], @c.get_fields('aaa')
 
+    @c['aaa'] = "aaa\xff"
+    assert_equal 2, @c.length
+
     assert_raise(ArgumentError){ @c['foo'] = "a\nb" }
     assert_raise(ArgumentError){ @c['foo'] = ["a\nb"] }
   end
@@ -73,9 +76,9 @@ class HTTPHeaderTest < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/net/http/test_httpheader.rb#L76
     assert_equal 'a, b, c, d, d', @c['My-Header']
     assert_equal ['a', 'b', 'c', 'd, d'], @c.get_fields('My-Header')
     assert_raise(ArgumentError){ @c.add_field 'My-Header', "d\nd" }
-    @c.add_field 'My-Header', ['e', ['f', 7]]
-    assert_equal 'a, b, c, d, d, e, f, 7', @c['My-Header']
-    assert_equal ['a', 'b', 'c', 'd, d', 'e', 'f', '7'], @c.get_fields('My-Header')
+    @c.add_field 'My-Header', ['e', ["\xff", 7]]
+    assert_equal "a, b, c, d, d, e, \xff, 7", @c['My-Header']
+    assert_equal ['a', 'b', 'c', 'd, d', 'e', "\xff", '7'], @c.get_fields('My-Header')
   end
 
   def test_get_fields
Index: ruby_2_3
===================================================================
--- ruby_2_3	(revision 62132)
+++ ruby_2_3	(revision 62133)

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /trunk:r60021

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

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