diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/unicorn/http_request.rb | 4 | ||||
-rw-r--r-- | lib/unicorn/tee_input.rb | 7 |
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 |