about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-04-01 08:43:30 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-04-01 08:43:30 +0000
commite20a52b735e83db3dbd20f1d96e947cc8bf82161 (patch)
tree3170a1182a60e4f82ee1af7efd157cbdc72f2696 /lib
parent6d1c93465b1c46acb9ede4bd0dbf3ab360981e6a (diff)
downloadunicorn-e20a52b735e83db3dbd20f1d96e947cc8bf82161.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@135 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib')
-rw-r--r--lib/mongrel.rb9
-rw-r--r--lib/mongrel/command.rb2
-rw-r--r--lib/mongrel/debug.rb13
3 files changed, 22 insertions, 2 deletions
diff --git a/lib/mongrel.rb b/lib/mongrel.rb
index e3f7653..25b9062 100644
--- a/lib/mongrel.rb
+++ b/lib/mongrel.rb
@@ -725,7 +725,6 @@ module Mongrel
     # is organized.
     def load_mime_map(file, mime={})
       # configure any requested mime map
-      log "Loading additional MIME types from #{file}"
       mime = load_yaml(file, mime)
       
       # check all the mime types to make sure they are the right format
@@ -786,11 +785,19 @@ module Mongrel
       MongrelDbg.begin_trace :rails
       MongrelDbg.begin_trace :files
       
+      uri location, :handler => plugin("/handlers/requestlog::access")
       uri location, :handler => plugin("/handlers/requestlog::files")
       uri location, :handler => plugin("/handlers/requestlog::objects")
       uri location, :handler => plugin("/handlers/requestlog::params")
     end
 
+    # Used to allow you to let users specify their own configurations
+    # inside your Configurator setup.  You pass it a script name and
+    # reads it in and does an eval on the contents passing in the right
+    # binding so they can put their own Configurator statements.
+    def run_config(script)
+      open(script) {|f| eval(f.read, proc {self}) }
+    end
 
     # Sets up the standard signal handlers that are used on most Ruby
     # It only configures if the platform is not win32 and doesn't do
diff --git a/lib/mongrel/command.rb b/lib/mongrel/command.rb
index 0341e15..a500ce0 100644
--- a/lib/mongrel/command.rb
+++ b/lib/mongrel/command.rb
@@ -52,7 +52,7 @@ module Mongrel
         @opt.on_tail("--version", "Show version") do
           @done_validating = true
           if VERSION
-            puts "Version #{VERSION}"
+            puts "Version #{MONGREL_VERSION}"
           end
         end
         
diff --git a/lib/mongrel/debug.rb b/lib/mongrel/debug.rb
index 6178872..e3c6504 100644
--- a/lib/mongrel/debug.rb
+++ b/lib/mongrel/debug.rb
@@ -219,6 +219,19 @@ end
 
 
 module RequestLog
+
+  # Just logs whatever requests it gets to STDERR (which ends up in the mongrel
+  # log when daemonized).
+  class Access < GemPlugin::Plugin "/handlers"
+    include Mongrel::HttpHandlerPlugin
+    
+    def process(request,response)
+      p = request.params
+      STDERR.puts "#{p['REMOTE_ADDR']} - [#{HttpServer.httpdate(Time.now)}] \"#{p['REQUEST_METHOD']} #{p["REQUEST_URI"]} HTTP/1.1\""
+    end
+  end
+  
+
   class Files < GemPlugin::Plugin "/handlers"
     include Mongrel::HttpHandlerPlugin