In mail "[ruby-talk:5033] Having problems with Net::HTTP::do_finish"
Dan Schmidt <dfan / harmonixmusic.com> wrote:
> I just started using Ruby yesterday, and I'm having trouble with my
> first real program. The following minimal example demonstrates the
> problem I'm encountering:
I could not reproduce this bug on my linux box. Then
could you tell me the result (stderr) of code below,
after using [ruby-dev:10990] patch? I attach it to
this mail again.
(test code)
require 'net/http'
http = Net::HTTP.new('www.ruby-lang.org')
http.set_pipe $stderr
http.start {}
p.s.
many thanks to Aleksi for interpreting my Japanese mails.
Minero Aoki
--- org.http.rb Thu Sep 21 06:26:21 2000
+++ http.rb Thu Sep 21 06:26:47 2000
@@ -238,6 +238,7 @@
require 'net/protocol'
+$stderr.sync = true
module Net
@@ -392,21 +393,26 @@
def keep_alive?( header, resp )
if resp.key? 'connection' then
if /keep-alive/i === resp['connection'] then
+$stderr.puts '[C] Connection true'
return true
end
elsif resp.key? 'proxy-connection' then
if /keep-alive/i === resp['proxy-connection'] then
+$stderr.puts '[C] Proxy Connection true'
return true
end
elsif header.key? 'Connection' then
if /keep-alive/i === header['Connection'] then
+$stderr.puts '[C] user Connection true'
return true
end
else
if @command.http_version == '1.1' then
+$stderr.puts '[C] HTTP1.1 true'
return true
end
end
+$stderr.puts '[C] connection close'
false
end
@@ -432,8 +438,11 @@
# called when connecting
def do_finish
+$stderr.puts "[F] addr=#{address} port=#{port}"
+$stderr.puts "[F] closed=#{@socket.closed?}"
+$stderr.puts "[F] critical=#{@command.send :critical?}"
unless @socket.closed? then
- head2 '/', { 'Connection' => 'close' }
+# head2 '/', { 'Connection' => 'close' }
end
end