Welcome to the "trac"-ing site of http-access2!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #150 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

Empty response in Fedora Core 6

Reported by: anonymous Assigned to: nahi
Priority: highest Milestone: 2.0.7
Component: core Version: 2.0
Keywords: Cc:

Description

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

Change History

04/29/07 20:09:07 changed by nahi

  • priority changed from normal to highest.
  • milestone changed from undefined to 2.0.7.

04/30/07 22:56:04 changed by nahi

  • status changed from new to closed.
  • resolution set to fixed.

I applied the patch in [143]. Much thanks!