there is no way to trap this information in Rails without lots of ugly hacking. I have the same goal as you so perhaps we can work together on this.
I'm currently looking at modifying Mongrel to handle this. It makes sense to put this support directly into the HTTP server. I can share my ideas with you if you are interested. Email me offline and we can discuss it.