* lib/net/http.rb: define Net::HTTPResponse#to_ary for backward compatibility. [ruby-talk:72927]

* lib/net/protocol.rb: add warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2003-06-06 07:05:52 +00:00
parent 56796022a6
commit 1fa5c630cd
3 changed files with 24 additions and 7 deletions

View File

@ -1,3 +1,10 @@
Fri Jun 6 16:10:01 2003 Minero Aoki <aamine@loveruby.net>
* lib/net/http.rb: define Net::HTTPResponse#to_ary for backward
compatibility. [ruby-talk:72927]
* lib/net/protocol.rb: add warning.
Thu Jun 5 21:31:55 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp> Thu Jun 5 21:31:55 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
* wince/stdlib.c: add mblen(). * wince/stdlib.c: add mblen().

View File

@ -1181,7 +1181,7 @@ module Net
return unless initheader return unless initheader
initheader.each do |k,v| initheader.each do |k,v|
key = k.downcase key = k.downcase
$stderr.puts "net/http: WARNING: duplicated HTTP header: #{k}" if @header.key?(key) and $VERBOSE $stderr.puts "net/http: warning: duplicated HTTP header: #{k}" if @header.key?(key) and $VERBOSE
@header[key] = v.strip @header[key] = v.strip
end end
@header['accept'] ||= '*/*' @header['accept'] ||= '*/*'
@ -1230,7 +1230,7 @@ module Net
@header.delete 'transfer-encoding' @header.delete 'transfer-encoding'
unless @header['content-type'] unless @header['content-type']
$stderr.puts 'net/http: WARNING: Content-Type did not set; using application/x-www-form-urlencoded' if $VERBOSE $stderr.puts 'net/http: warning: Content-Type did not set; using application/x-www-form-urlencoded' if $VERBOSE
@header['content-type'] = 'application/x-www-form-urlencoded' @header['content-type'] = 'application/x-www-form-urlencoded'
end end
@ -1598,12 +1598,22 @@ module Net
attr_reader :http_version attr_reader :http_version
attr_reader :code attr_reader :code
attr_reader :message attr_reader :message
alias msg message alias msg message # for backward compatibility
def inspect def inspect
"#<#{self.class} #{@code} readbody=#{@read}>" "#<#{self.class} #{@code} readbody=#{@read}>"
end end
# For backward compatibility.
# To allow Net::HTTP 1.1 style assignment
# e.g.
# response, body = Net::HTTP.get(....)
#
def to_ary
warn "net/http: warning: old style assignment found at #{caller(1)[0]}" if $VERBOSE
[self, body()]
end
# #
# response <-> exception relationship # response <-> exception relationship
# #

View File

@ -5,17 +5,17 @@
Copyright (c) 1999-2003 Yukihiro Matsumoto Copyright (c) 1999-2003 Yukihiro Matsumoto
Copyright (c) 1999-2003 Minero Aoki Copyright (c) 1999-2003 Minero Aoki
written & maintained by Minero Aoki <aamine@loveruby.net> written and maintained by Minero Aoki <aamine@loveruby.net>
This program is free software. You can re-distribute and/or This program is free software. You can re-distribute and/or
modify this program under the same terms as Ruby itself, modify this program under the same terms as Ruby itself,
Ruby Distribute License or GNU General Public License. Ruby Distribute License or GNU General Public License.
NOTE: You can find Japanese version of this document in
the doc/net directory of the standard ruby interpreter package.
$Id$ $Id$
WARNING: This file is going to remove.
Do not rely on the implementation written in this file.
=end =end
require 'socket' require 'socket'