about summary refs log tree commit homepage
path: root/lib/mongrel/cgi.rb
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-04 17:55:39 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-03-04 17:55:39 +0000
commitd150cae4777ae8722397901eb64f1cd53a74aa91 (patch)
tree804cb68d0ccd13253eee6449c99c0c9142542617 /lib/mongrel/cgi.rb
parentec5d3f2b6c30e847d3e174d2b0d7bad7e0b1af60 (diff)
downloadunicorn-d150cae4777ae8722397901eb64f1cd53a74aa91.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@74 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib/mongrel/cgi.rb')
-rw-r--r--lib/mongrel/cgi.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/mongrel/cgi.rb b/lib/mongrel/cgi.rb
index 3d7d25a..14982e0 100644
--- a/lib/mongrel/cgi.rb
+++ b/lib/mongrel/cgi.rb
@@ -1,14 +1,28 @@
 require 'cgi'
 
 module Mongrel
-    # The beginning of a complete wrapper around Mongrel's internal HTTP processing
+  # The beginning of a complete wrapper around Mongrel's internal HTTP processing
   # system but maintaining the original Ruby CGI module.  Use this only as a crutch
   # to get existing CGI based systems working.  It should handle everything, but please
   # notify me if you see special warnings.  This work is still very alpha so I need
   # testers to help work out the various corner cases.
+  #
+  # The CGIWrapper.handler attribute is normally not set and is available for
+  # frameworks that need to get back to the handler.  Rails uses this to give
+  # people access to the RailsHandler#files (DirHandler really) so they can
+  # look-up paths and do other things withthe files managed there.
+  #
+  # In Rails you can get the real file for a request with:
+  #
+  #  path = @request.cgi.handler.files.can_serve(@request['PATH_INFO'])
+  #
+  # Which is ugly but does the job.  Feel free to write a Rails helper for that.
+  # Refer to DirHandler#can_serve for more information on this.
   class CGIWrapper < ::CGI
     public :env_table
     attr_reader :options
+    attr_reader :handler
+    attr_writer :handler
 
     # these are stripped out of any keys passed to CGIWrapper.header function
     REMOVED_KEYS = [ "nph","status","server","connection","type",
@@ -143,5 +157,6 @@ module Mongrel
       STDERR.puts "WARNING: Your program is doing something not expected.  Please tell Zed that stdoutput was used and what software you are running.  Thanks."
       @response.body
     end    
+
   end
 end