summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-08 14:16:21 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-08 14:16:21 +0000
commit2cb1399c8fead4dd191e52b043ffc82ea3964c04 (patch)
treeea386f5e4471b09bae6de95bdf26b836bc019844
parent14371fce68acd0ce292af46d1b1ce7af9565bf3e (diff)
* 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
-rw-r--r--ChangeLog6
-rw-r--r--lib/net/http.rb27
2 files changed, 20 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index c519b9374d..a775d5f663 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* lib/net/http.rb (add_header): remove warning. [ruby-dev:23170]
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