Hi,
In mail "[ruby-talk:03056] Bug in HTTP close"
Andrew Hunt <Andy / Toolshed.Com> wrote:
> I think I have found a couple of small problems in the network code.
>
> 1) In net/protocol.rb, around line 417:
I think this as feature. Because it is natural that closing
already closed socket raises exception and usually closing one
socket twice is not a intent but a bug. (like this time ^_^;;)
> 2) In net/http.rb, a socket may be closed one of two ways:
> the socket will be closed if keep_alive? is false
> the socket will be closed if there's a "connection: close" header.
I fix this bug in next check-in. Thank you!
-------------------------------------------------------------------
Minero Aoki
diff -u -r1.10.2.16 http.rb
--- http.rb 2000/05/22 13:46:48 1.10.2.16
+++ http.rb 2000/06/01 09:43:36
@@ -249,8 +249,12 @@
if /keep-alive/i === resp['connection'] then
return true
end
+ elsif resp.key? 'proxy-connection' then
+ if /keep-alive/i === resp['proxy-connection'] then
+ return true
+ end
elsif header.key? 'Connection' then
- if /\A\s*keep-alive/i === header['Connection'] then
+ if /keep-alive/i === header['Connection'] then
return true
end
else
@@ -518,12 +522,10 @@
tmp = resp['connection']
if tmp and /close/i === tmp then
@socket.read_all dest
- @socket.close
else
tmp = resp['proxy-connection']
if tmp and /close/i === tmp then
@socket.read_all dest
- @socket.close
end
end
end