I've been running http-access2 2.0.6 on FC6 with ruby 1.8.5. Sometimes I saw empty responses returned from post_content() even though complete response has been sent back from server (observed using tcpdump on the interface). The reason turned out to be in Session::get_data()
until eof?
begin
timeout(@receive_timeout) do
data = read_body()
end
rescue TimeoutError
raise
end
Here, eof? eventually calls @socket.eof?, which returns true the first time we call this method, then we break out of get_data() without reading anything.
The following patch appears to fix this problem:
@@ -1294,7 +1294,7 @@
end
data = nil
if block
- until eof?
+ while 1
begin
timeout(@receive_timeout) do
data = read_body()
@@ -1303,6 +1303,7 @@
raise
end
block.call(data) if data
+ break if eof?
end
data = nil # Calling with block returns nil.
else