about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-04-21 15:31:58 -0700
committerEric Wong <normalperson@yhbt.net>2010-04-21 16:23:09 -0700
commita0ee3ba2d08acb423a1cbc4a5ae862bd40c4b914 (patch)
treeca4268918acaaed138291de6a6363748b59e3adb /lib
parent9c6fd3814b6bed2772fc540e7824febe85e9b046 (diff)
downloadclogger-a0ee3ba2d08acb423a1cbc4a5ae862bd40c4b914.tar.gz
This quiets down warnings when used with RubyGems loaders such
as Isolate and Bundler where the HTTP server already loaded
Rack.
Diffstat (limited to 'lib')
-rw-r--r--lib/clogger.rb2
-rw-r--r--lib/clogger/pure.rb5
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/clogger.rb b/lib/clogger.rb
index 641d5c5..8567c91 100644
--- a/lib/clogger.rb
+++ b/lib/clogger.rb
@@ -1,4 +1,6 @@
 # -*- encoding: binary -*-
+autoload :Rack, 'rack'
+
 class Clogger
   VERSION = '0.3.2'
 
diff --git a/lib/clogger/pure.rb b/lib/clogger/pure.rb
index b871c62..e9a8e6a 100644
--- a/lib/clogger/pure.rb
+++ b/lib/clogger/pure.rb
@@ -1,13 +1,14 @@
 # -*- encoding: binary -*-
 # :stopdoc:
 
-require 'rack'
-
 # Not at all optimized for performance, this was written based on
 # the original C extension code so it's not very Ruby-ish...
 class Clogger
 
   def initialize(app, opts = {})
+    # trigger autoload to avoid thread-safety issues later on
+    Rack::Utils::HeaderHash.new({})
+
     @app = app
     @logger = opts[:logger]
     (@logger.sync = true) rescue nil