summaryrefslogtreecommitdiff
path: root/test/net/http
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-25 14:28:53 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-25 14:28:53 +0000
commit56f91c6ec52deb3808c426a6d53ac4616527e5ad (patch)
tree483be6cfb14a22595a6927251a614500a5b0294a /test/net/http
parent0c482713dda3d8027b12c687b31a5fb5a9487786 (diff)
HTTPHeader#add_field should allow binary [Bug #13926]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/net/http')
-rw-r--r--test/net/http/test_httpheader.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb
index 0a2c57dcb8..c9b8b3c406 100644
--- a/test/net/http/test_httpheader.rb
+++ b/test/net/http/test_httpheader.rb
@@ -45,6 +45,9 @@ class HTTPHeaderTest < Test::Unit::TestCase
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::TestCase
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