* lib/net/http.rb: HTTPHeader did not initialized correctly.
* lib/net/http.rb (connect): does same debug output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
14371fce68
commit
2cb1399c8f
@ -1,3 +1,9 @@
|
|||||||
|
Mon Mar 8 23:16:07 2004 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* lib/net/http.rb: HTTPHeader did not initialized correctly.
|
||||||
|
|
||||||
|
* lib/net/http.rb (connect): does same debug output.
|
||||||
|
|
||||||
Mon Mar 8 21:38:18 2004 Minero Aoki <aamine@loveruby.net>
|
Mon Mar 8 21:38:18 2004 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* lib/net/http.rb (add_header): remove warning. [ruby-dev:23170]
|
* lib/net/http.rb (add_header): remove warning. [ruby-dev:23170]
|
||||||
|
@ -448,7 +448,9 @@ module Net # :nodoc:
|
|||||||
private :do_start
|
private :do_start
|
||||||
|
|
||||||
def connect
|
def connect
|
||||||
|
D "opening connection to #{conn_address()}..."
|
||||||
s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }
|
s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }
|
||||||
|
D "opened"
|
||||||
if use_ssl?
|
if use_ssl?
|
||||||
unless @ssl_context.verify_mode
|
unless @ssl_context.verify_mode
|
||||||
warn "warning: peer certificate won't be verified in this SSL session"
|
warn "warning: peer certificate won't be verified in this SSL session"
|
||||||
@ -1012,6 +1014,15 @@ module Net # :nodoc:
|
|||||||
#
|
#
|
||||||
module HTTPHeader
|
module HTTPHeader
|
||||||
|
|
||||||
|
def initialize_http_header(initheader)
|
||||||
|
@header = {}
|
||||||
|
return unless initheader
|
||||||
|
initheader.each do |key, value|
|
||||||
|
warn "net/http: warning: duplicated HTTP header: #{key}" if key?(key) and $VERBOSE
|
||||||
|
@header[key.downcase] = [value.strip]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def size #:nodoc: obsolete
|
def size #:nodoc: obsolete
|
||||||
@header.size
|
@header.size
|
||||||
end
|
end
|
||||||
@ -1295,17 +1306,8 @@ e @header.each_key(&block)
|
|||||||
@response_has_body = resbody
|
@response_has_body = resbody
|
||||||
raise ArgumentError, "HTTP request path is empty" if path.empty?
|
raise ArgumentError, "HTTP request path is empty" if path.empty?
|
||||||
@path = path
|
@path = path
|
||||||
|
initialize_http_header initheader
|
||||||
@header = {}
|
self['Accept'] ||= '*/*'
|
||||||
if initheader
|
|
||||||
initheader.each do |k,v|
|
|
||||||
key = k.downcase
|
|
||||||
warn "net/http: warning: duplicated HTTP header: #{k}" if @header.key?(key) and $VERBOSE
|
|
||||||
@header[key] = v.strip
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@header['accept'] ||= '*/*'
|
|
||||||
|
|
||||||
@body = nil
|
@body = nil
|
||||||
@body_stream = nil
|
@body_stream = nil
|
||||||
end
|
end
|
||||||
@ -1868,8 +1870,7 @@ e @header.each_key(&block)
|
|||||||
@http_version = httpv
|
@http_version = httpv
|
||||||
@code = code
|
@code = code
|
||||||
@message = msg
|
@message = msg
|
||||||
|
initialize_http_header nil
|
||||||
@header = {}
|
|
||||||
@body = nil
|
@body = nil
|
||||||
@read = false
|
@read = false
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user