diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-05 09:50:38 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-05 09:50:38 +0000 |
commit | 0ff14af9faf3fc06b1608437d83939f910dbac21 (patch) | |
tree | 83eb8f5ee234a6ea1048460e870be36e75a3dcc8 | |
parent | 13d62dfa79ae5f174279b0dabee14cc53c5e8857 (diff) | |
download | ruby-0ff14af9faf3fc06b1608437d83939f910dbac21.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/net/http.rb | 14 |
2 files changed, 13 insertions, 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. 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 #[]. |