服务器版本: Apache/2.2.22 (Debian)服务器构建日期:2013年3月4日22:05:29
Phusion客运版4.0.21
Alias /tester /var/www/tester/public
<Location /tester>
PassengerBaseURI /tester
PassengerAppRoot /var/www/tester
</Location>
<Directory /var/www/tester>
Allow from all
Options -MultiViews
#Enable response streaming
PassengerBufferResponse off
</Directory>你好,我在使用Apache时遇到了“流”问题。如果我试图运行以下代码,它将在发送到客户端之前完成处理;
#app.rb
require 'sinatra'
get '/' do
stream do |out|
out << "foo\n"
sleep 10
out << "bar\n"
end
end如果我运行的应用程序启动瘦,西纳屈,或乘客从CLI,它将流'foo',然后稍后将流'bar‘。
知道Apache为什么要缓冲输出吗?
发布于 2014-01-06 13:23:57
这是辛纳屈的一个限制。Sinatra流API只支持基于EventMachine的服务器,而Phusion客运则不支持。不要使用Sinatra流API,而是直接使用低级的Rack API来实现流。为此,您可以使用Rack套接字劫持API通过套接字发送原始HTTP响应。
https://stackoverflow.com/questions/20941076
复制相似问题