seancribbs/webmachine-ruby — pull request #110 by pawelpacana (2013-07-18 11:44:03+00:00)
Title: Streaming in Rack adapter

Looks like I broke streaming support in Rack adapter in https://github.com/seancribbs/webmachine-ruby/commit/41fb3885d1d216e91cf29d3c60dd24da5c146912.

But first a little background. The intention of `Rack::Response` wrapping was to let Rack do the cleanup regarding `Content-Type`, e.g. for https://github.com/seancribbs/webmachine-ruby/commit/f33677849d0c1cad8362a625d17447b87fe56289. This `Content-Type` requirement has changed in latest releases but wrapping did always the right cleanup for particular release. Original PR is here https://github.com/seancribbs/webmachine-ruby/pull/68.

I did not notice that `Rack::Response` iterates over given body https://github.com/rack/rack/blob/master/lib/rack/response.rb#L35-L38 which in some cases (when enumerable could not be exhausted) blocked responding to client. Until I realized that I've started fixing streaming with hijacking https://github.com/seancribbs/webmachine-ruby/commit/b7322f9f8881a6451a1bc340f4af689692f5fe17.

Now it seems it's best to revert `Rack::Response` and backport its `Content-Type` cleanups satisfying `Rack::Lint` for several Rack releases to adapter. I would love to know your opinion on this.