diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-08-19 20:47:29 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-08-19 20:54:46 +0000 |
commit | 1077961a3f8933c65d39c7e6c9ed6ff3b6b53647 (patch) | |
tree | a2f6646f1f52761a316e012964818a6fbdb7899f /lib/unicorn.rb | |
parent | 7fe08addefb12bd2f4c63901e8cf631e9162ca51 (diff) | |
download | unicorn-1077961a3f8933c65d39c7e6c9ed6ff3b6b53647.tar.gz |
This is needed to match the behavior of Rack::Server for RACK_ENV=(deployment|development), actually. This won't affect users of other RACK_ENV values. This change has minor performance consequences, so users negatively affected should set RACK_ENV to "none" instead for full control of their middleware stack. This mainly affects Rainbows!/Zbatery users since they have persistent connections and /need/ Content-Length or Transfer-Encoding:chunked headers.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r-- | lib/unicorn.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index bb5409b..b882ce3 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -50,9 +50,14 @@ module Unicorn pp({ :inner_app => inner_app }) if $DEBUG # return value, matches rackup defaults based on env + # Unicorn does not support persistent connections, but Rainbows! + # and Zbatery both do. Users accustomed to the Rack::Server default + # middlewares will need ContentLength/Chunked middlewares. case ENV["RACK_ENV"] when "development" Rack::Builder.new do + use Rack::ContentLength + use Rack::Chunked use Rack::CommonLogger, $stderr use Rack::ShowExceptions use Rack::Lint @@ -60,6 +65,8 @@ module Unicorn end.to_app when "deployment" Rack::Builder.new do + use Rack::ContentLength + use Rack::Chunked use Rack::CommonLogger, $stderr run inner_app end.to_app |