about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-05-06 19:05:13 +0000
committerEric Wong <normalperson@yhbt.net>2010-05-06 19:15:43 +0000
commit86c544aa864ad8d0ef65ef43c9e765eb4d37a4ab (patch)
tree566268cafc2422e0953553b219d61170442220c5
parent0a79e0cde133155144dbd52d56f1259f24d46ea3 (diff)
downloadunicorn-86c544aa864ad8d0ef65ef43c9e765eb4d37a4ab.tar.gz
It's too complicated and error-prone to allow apps to use a
different version of Rack than the one Unicorn would otherwise
use by default.

If an app requires a different version of Rack than what Unicorn
would load by default, it is recommended they only install that
version of Rack (and no others) since Unicorn does not have any
strict requirements on currently released Rack versions.

If it is not possible to only have one Rack version installed
globally, then they should either use Isolate or Bundler and
install a private version of Unicorn along with their preferred
version of Rack.  Users who install in this way are recommended
to execute the isolated/bundled version of Unicorn, instead of
what would normally be in $PATH.

Feedback/tips to mailto:mongrel-unicorn@rubyforge.org from
Isolate and Bundler users would be greatly appreciated.
-rw-r--r--lib/unicorn.rb16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index 14e0e52..70222f4 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -2,17 +2,14 @@
 
 require 'fcntl'
 require 'etc'
+require 'rack'
 require 'unicorn/socket_helper'
 require 'unicorn/const'
 require 'unicorn/http_request'
 require 'unicorn/configurator'
 require 'unicorn/util'
 require 'unicorn/tee_input'
-
-# autoload this so the app can prefer a different version, we
-# don't rely on Rack itself for much and should be compatible for
-# 1.0.x and 1.1.x+
-autoload :Rack, 'rack'
+require 'unicorn/http_response'
 
 # Unicorn module containing all of the classes (include C extensions) for running
 # a Unicorn web server.  It contains a minimalist HTTP server with just enough
@@ -26,11 +23,6 @@ module Unicorn
   class ClientShutdown < EOFError
   end
 
-  # we load HttpResponse last since it depends on Rack, and we
-  # want the application to be able to specify Rack (if they're
-  # *not* using config.ru)
-  autoload :HttpResponse, 'unicorn/http_response'
-
   class << self
     def run(app, options = {})
       HttpServer.new(app, options).start.join
@@ -822,10 +814,6 @@ module Unicorn
           Gem.refresh
         end
         self.app = app.call
-
-        # exploit COW in case of preload_app.  Also avoids race
-        # conditions in Rainbows! since load/require are not thread-safe
-        Unicorn.const_get :HttpResponse
       end
     end