mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
13d62dfa79
commit
0ff14af9fa
2 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Feb 5 18:49:00 2006 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* lib/net/http.rb (add_field, get_fields): keep 1.8.2
|
||||
compatibility. This patch is contributed by Rob Pitt.
|
||||
|
||||
Sun Feb 5 16:33:50 2006 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||
|
||||
* lib/mkmf.rb (create_makefile): Kernel#sub! was removed on HEAD.
|
||||
|
|
|
@ -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>.
|
||||
|
@ -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 #[].
|
||||
|
|
Loading…
Reference in a new issue