Mongrel - "Status: 500" appears in HTTP response body, not headers

On Rails 1.2.5 (and also edge Rails) with Mongrel 1.1.1, the 500
Internal Server Error status code for the 500.html failsafe page isn't
being served correctly. It appears at the top of the HTTP response
body, but the actual response is sent with status 200 OK.

Specifically, this happens when a database error occurs while
active_record_store sessions are in use. To replicate:
Create a fresh rails project (but deliberately don't create the
corresponding database):
    rails db_failure_test
Edit config/environment.rb and uncomment the line
    config.action_controller.session_store = :active_record_store
Start script/server, and visit

The text "Status: 500 Internal Server Error Content-Type: text/html"
appears at the top of the response, but inspecting the headers using
the Firefox LiveHTTPHeaders extension (or raw HTTP over telnet), it's
actually served as a 200 OK response.

This is a bit of an irritation, partly because I'd prefer not to have
technobabble appearing on my friendly error pages, but mostly because
I'd like to set up Nagios monitoring to catch the 500 status when the
database falls over.

I've had an initial poke at the code, but ultimately it's not clear
whether this is a Mongrel or Rails bug - and it's also a bit tricky to
google (because understandably, people tend to be more interested in
getting rid of errors than serving them correctly...). Any suggestions
about what I can tweak, or at least which project I should be sending
a bug report to?

- Matt