crohr/rack-jsonp — pull request #5 by morhekil (2011-10-16 14:41:00+00:00)
Title: Fix for thread failures with Rails 3.1

Hello,

I'm using Rack::JSONP with my Rails project, and after migrating it to Rails 3.1 I've started to get thread failures on every other jsonp request. Looking into the issues, it drilled down to the fact that Rails returns Rack::BodyProxy object instead of just plain array of strings, and when you were just throwing it away - it was either garbage collected or something else later, and caused these issues.

I've added explicit closing of application's responses if they respond to #close, so it should handle not only Rack::BodyProxy, but hopefully any other body abstractions applications can pass through the rack stack.

Feel free to modify/ask anything.

Thank you.