diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-08 14:16:21 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-08 14:16:21 +0000 |
commit | 2cb1399c8fead4dd191e52b043ffc82ea3964c04 (patch) | |
tree | ea386f5e4471b09bae6de95bdf26b836bc019844 /lib/net/http.rb | |
parent | 14371fce68acd0ce292af46d1b1ce7af9565bf3e (diff) | |
download | ruby-2cb1399c8fead4dd191e52b043ffc82ea3964c04.tar.gz |
* 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
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r-- | lib/net/http.rb | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index 7cd0acd659..7abde21670 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -448,7 +448,9 @@ module Net # :nodoc: private :do_start def connect + D "opening connection to #{conn_address()}..." s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) } + D "opened" if use_ssl? unless @ssl_context.verify_mode warn "warning: peer certificate won't be verified in this SSL session" @@ -1012,6 +1014,15 @@ module Net # :nodoc: # 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 @header.size end @@ -1295,17 +1306,8 @@ e @header.each_key(&block) @response_has_body = resbody raise ArgumentError, "HTTP request path is empty" if path.empty? @path = path - - @header = {} - 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'] ||= '*/*' - + initialize_http_header initheader + self['Accept'] ||= '*/*' @body = nil @body_stream = nil end @@ -1868,8 +1870,7 @@ e @header.each_key(&block) @http_version = httpv @code = code @message = msg - - @header = {} + initialize_http_header nil @body = nil @read = false end |