On Thu, Sep 04, 2008 at 06:00:54PM +0100, Brian Candler wrote:
> If you return an open IO object as the response body, and the client
> requests HTTP/1.1, then the response is unterminated - so the client hangs
> around forever waiting for the end of the response (or at least, until the
> HTTP/1.1 connection times out)

I'd like to propose a patch for this issue.

--- httpresponse.rb.orig	2008-09-12 13:40:50.000000000 +0100
+++ httpresponse.rb	2008-09-12 13:53:34.000000000 +0100
@@ -150,12 +150,11 @@
       # Keep-Alive connection.
       if @header['connection'] == "close"
          @keep_alive = false
-      elsif keep_alive?
-        if chunked? || @header['content-length']
-          @header['connection'] = "Keep-Alive"
-        end
+      elsif keep_alive? && (chunked? || @header['content-length'])
+        @header['connection'] = "Keep-Alive"
       else
         @header['connection'] = "close"
+        @keep_alive = false
       end
 
       # Location is a single absoluteURI.
 
The existing code path makes no adjustment if keep_alive? is true but
neither chunked? nor content-length is set. I cannot see any scenario in
which that would be a useful behaviour (since the response has no way of
indicating termination to the client). However if I have misunderstood, I
would be happy to have it explained to me.

Thanks,

Brian.