about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-05-13 11:38:05 -0700
committerEric Wong <normalperson@yhbt.net>2009-05-13 11:38:05 -0700
commit357c610c63e8d6bc4825061ed06d6492edd176cd (patch)
treed69de49f8ac8c6d0dbd9bd5ebbf3e34dfd34b9be
parente900cdc15772f7b2cab4d9fb72de8aee963d260f (diff)
downloadunicorn-357c610c63e8d6bc4825061ed06d6492edd176cd.tar.gz
Unicorn proper no longer needs these constants,
so don't bother with them.
-rw-r--r--lib/unicorn/app/old_rails/static.rb10
-rw-r--r--lib/unicorn/const.rb7
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/unicorn/app/old_rails/static.rb b/lib/unicorn/app/old_rails/static.rb
index 7ec6b6d..17c007c 100644
--- a/lib/unicorn/app/old_rails/static.rb
+++ b/lib/unicorn/app/old_rails/static.rb
@@ -22,6 +22,8 @@ require 'rack/file'
 class Unicorn::App::OldRails::Static
   FILE_METHODS = { 'GET' => true, 'HEAD' => true }.freeze
   REQUEST_METHOD = 'REQUEST_METHOD'.freeze
+  REQUEST_URI = 'REQUEST_URI'.freeze
+  PATH_INFO = 'PATH_INFO'.freeze
 
   def initialize(app)
     @app = app
@@ -34,10 +36,10 @@ class Unicorn::App::OldRails::Static
     FILE_METHODS.include?(env[REQUEST_METHOD]) or return @app.call(env)
 
     # first try the path as-is
-    path_info = env[Unicorn::Const::PATH_INFO].chomp("/")
+    path_info = env[PATH_INFO].chomp("/")
     if File.file?("#@root/#{::Rack::Utils.unescape(path_info)}")
       # File exists as-is so serve it up
-      env[Unicorn::Const::PATH_INFO] = path_info
+      env[PATH_INFO] = path_info
       return @file_server.call(env)
     end
 
@@ -45,11 +47,11 @@ class Unicorn::App::OldRails::Static
 
     # grab the semi-colon REST operator used by old versions of Rails
     # this is the reason we didn't just copy the new Rails::Rack::Static
-    env[Unicorn::Const::REQUEST_URI] =~ /^#{Regexp.escape(path_info)}(;[^\?]+)/
+    env[REQUEST_URI] =~ /^#{Regexp.escape(path_info)}(;[^\?]+)/
     path_info << "#$1#{ActionController::Base.page_cache_extension}"
 
     if File.file?("#@root/#{::Rack::Utils.unescape(path_info)}")
-      env[Unicorn::Const::PATH_INFO] = path_info
+      env[PATH_INFO] = path_info
       return @file_server.call(env)
     end
 
diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb
index 263ea10..241c52e 100644
--- a/lib/unicorn/const.rb
+++ b/lib/unicorn/const.rb
@@ -8,13 +8,6 @@ module Unicorn
   # gave about a 3% to 10% performance improvement over using the strings directly.
   # Symbols did not really improve things much compared to constants.
   module Const
-    # This is the part of the path after the SCRIPT_NAME.
-    PATH_INFO="PATH_INFO".freeze
-
-    # The original URI requested by the client.
-    REQUEST_URI='REQUEST_URI'.freeze
-    REQUEST_PATH='REQUEST_PATH'.freeze
-
     UNICORN_VERSION="0.7.0".freeze
 
     DEFAULT_HOST = "0.0.0.0".freeze # default TCP listen host address