streaming broken in rack >= 1.3.7 #615

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@tobowers

small commit that fixes streaming (for us) can repro by using included sample chat app in the sinatra codebase.

@tobowers tobowers Rack >= 1.3.7 returns a Rack::BodyProxy instead of Rack::Response and…
… breaks all sinatra streaming. This commit looks for either type.
acbdaac
@rkh rkh commented on the diff Jan 18, 2013
lib/sinatra/base.rb
@@ -64,7 +64,7 @@ def accept_entry(entry)
# http://rack.rubyforge.org/doc/classes/Rack/Response/Helpers.html
class Response < Rack::Response
def body=(value)
- value = value.body while Rack::Response === value
+ value = value.body while (Rack::Response === value) or (defined?(Rack::BodyProxy) && Rack::BodyProxy === value)
@rkh
rkh Jan 18, 2013 Sinatra member

This will skip potential callbacks on the proxy, won't it?

@tobowers
tobowers Jan 18, 2013

oh hrm... I guess I don't know well enough how this works... this fixed sinatra streaming for us and we don't see any issues, but there could be gaping holes I'm not thinking of.

@rkh
rkh Jan 19, 2013 Sinatra member

Gonna have to play with this. I guess if you should for instance do a enable :lock you will run into a deadlock with this code.

@rkh rkh closed this Jan 26, 2013
@magnetised magnetised added a commit to magnetised/spontaneous that referenced this pull request Jun 27, 2014
@magnetised magnetised Fix Rack at 1.4.1 until Sinatra streaming is fixed f689f51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment