summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-05 09:50:38 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-05 09:50:38 +0000
commit0ff14af9faf3fc06b1608437d83939f910dbac21 (patch)
tree83eb8f5ee234a6ea1048460e870be36e75a3dcc8 /lib
parent13d62dfa79ae5f174279b0dabee14cc53c5e8857 (diff)
* lib/net/http.rb (add_field, get_fields): keep 1.8.2 compatibility. This patch is contributed by Rob Pitt.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/http.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index d4dda5c8e7..3f05d81073 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1,8 +1,8 @@
#
# = net/http.rb
#
-# Copyright (c) 1999-2005 Yukihiro Matsumoto
-# Copyright (c) 1999-2005 Minero Aoki
+# Copyright (c) 1999-2006 Yukihiro Matsumoto
+# Copyright (c) 1999-2006 Minero Aoki
# Copyright (c) 2001 GOTOU Yuuzou
#
# Written and maintained by Minero Aoki <aamine@loveruby.net>.
@@ -154,7 +154,7 @@ module Net #:nodoc:
# require 'net/http'
# require 'uri'
#
- # def fetch( uri_str, limit = 10 )
+ # def fetch(uri_str, limit = 10)
# # You should choose better exception.
# raise ArgumentError, 'HTTP redirect too deep' if limit == 0
#
@@ -1156,9 +1156,10 @@ module Net #:nodoc:
@header.delete key.downcase
return val
end
- @header[key.downcase] = Array(val).map {|s| s.to_str }
+ @header[key.downcase] = [val]
end
+ # [Ruby 1.8.3]
# Adds header field instead of replace.
# Second argument +val+ must be a String.
# See also #[]=, #[] and #get_fields.
@@ -1175,12 +1176,13 @@ module Net #:nodoc:
#
def add_field(key, val)
if @header.key?(key.downcase)
- @header[key.downcase].concat Array(val)
+ @header[key.downcase].concat [val]
else
- @header[key.downcase] = Array(val).dup
+ @header[key.downcase] = [val]
end
end
+ # [Ruby 1.8.3]
# Returns an array of header field strings corresponding to the
# case-insensitive +key+. This method allows you to get duplicated
# header fields without any processing. See also #[].