about summary refs log tree commit homepage
path: root/lib/unicorn
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-09-29 23:57:57 -0700
committerEric Wong <normalperson@yhbt.net>2010-10-04 21:01:27 +0000
commitdfc5f5a5e4aec4578b79de68c91906da75472a5a (patch)
tree6332e1c382783ab1bc18b269109aac4c3317894e /lib/unicorn
parentfe94d80cb37ee441762ad2a8f5c25092f8eb57a8 (diff)
downloadunicorn-dfc5f5a5e4aec4578b79de68c91906da75472a5a.tar.gz
This should ensure we have less typing to do.
Diffstat (limited to 'lib/unicorn')
-rw-r--r--lib/unicorn/http_request.rb4
-rw-r--r--lib/unicorn/tee_input.rb7
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb
index 8abc945..c12f721 100644
--- a/lib/unicorn/http_request.rb
+++ b/lib/unicorn/http_request.rb
@@ -21,6 +21,8 @@ module Unicorn
     NULL_IO = StringIO.new("")
     LOCALHOST = '127.0.0.1'
 
+    attr_reader :env, :parser, :buf
+
     def initialize
       @parser = Unicorn::HttpParser.new
       @buf = ""
@@ -67,7 +69,7 @@ module Unicorn
         end while @parser.headers(@env, @buf).nil?
       end
       @env[Const::RACK_INPUT] = 0 == @parser.content_length ?
-                   NULL_IO : Unicorn::TeeInput.new(socket, @env, @parser, @buf)
+                   NULL_IO : Unicorn::TeeInput.new(socket, self)
       @env.merge!(DEFAULTS)
     end
   end
diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb
index 540cfe0..7e508fc 100644
--- a/lib/unicorn/tee_input.rb
+++ b/lib/unicorn/tee_input.rb
@@ -25,8 +25,11 @@ class Unicorn::TeeInput < Struct.new(:socket, :req, :parser,
 
   # Initializes a new TeeInput object.  You normally do not have to call
   # this unless you are writing an HTTP server.
-  def initialize(*args)
-    super(*args)
+  def initialize(socket, request)
+    self.socket = socket
+    self.req = request.env
+    self.parser = request.parser
+    self.buf = request.buf
     self.len = parser.content_length
     self.tmp = len && len < @@client_body_buffer_size ?
                StringIO.new("") : Unicorn::Util.tmpio