Mongrel 1.1.4, possible bug http_response

Hi,

I found this while digging inside mongrel to provide IO streaming
for mongrel (and thus for Rack and Ramaze):

  • In socket_error a local variable done is set, which has no effect.
  • done=() always sets to true, where it (for completeness sake) should
    honor the passed value.

— a/http_response.rb 2008-03-11 16:59:24.000000000 +0100
+++ b/http_response.rb 2008-03-11 17:02:20.000000000 +0100
@@ -129,7 +129,7 @@
def socket_error(details)
# ignore these since it means the client closed off early
@socket.close rescue nil

  •  done = true
    
  •  self.done = true
      raise details
    end
    

@@ -150,9 +150,9 @@
# Used during error conditions to mark the response as “done” so
there isn’t any more processing
# sent to the client.
def done=(val)

  •  @status_sent = true
    
  •  @header_sent = true
    
  •  @body_sent = true
    
  •  @status_sent = val
    
  •  @header_sent = val
    
  •  @body_sent = val
    end
    
    def done
    
  • If done=() is never reverted, it might be more beneficial to replace
    done=(val) just by a done!() and call that in socket_error() instead.

Regards,

Jo

Thanks. File a ticket please if you think it’s definitely bug:

http://mongrel.rubyforge.org/report/1

Evan

Hi,

Thanks. File a ticket please if you think it’s definitely bug:

http://mongrel.rubyforge.org/report/1

sorry to be a bother, but:

I can’t decide if it is really a bug, as my knowledge regarding mongrel
innards is next to non-existant.
The implications of ‘done’ being set or not set in certain corner cases
is not something which I can easily be sure of.

I found this while digging inside mongrel to provide IO streaming
for mongrel (and thus for Rack and Ramaze):

  • In socket_error a local variable done is set, which has no effect.
  • done=() always sets to true, where it (for completeness sake) should
    honor the passed value.
  • If done=() is never reverted, it might be more beneficial to replace
    done=(val) just by a done!() and call that in socket_error() instead.

As I see it, done=() is never called at the moment (I might be wrong),
and
Mongrel still works. Making done=() work correctly might have other
implications. Right now it might process additional handlers
(mongrel.rb:
160) which it might not do after the fix.

Jo