def initialize(params, socket, dispatchers)
@params = params
@socket = socket
@dispatchers = dispatchers
content_length = @params[Const::CONTENT_LENGTH].to_i
remain = content_length - @params.http_body.length
@dispatchers.each do |dispatcher|
dispatcher.request_begins(@params)
end unless @dispatchers.nil? || @dispatchers.empty?
if remain <= 0
@body = StringIO.new
@body.write @params.http_body
update_request_progress(0, content_length)
elsif remain > 0
if remain > Const::MAX_BODY
@body = Tempfile.new(Const::MONGREL_TMP_BASE)
@body.binmode
else
@body = StringIO.new
end
@body.write @params.http_body
read_body(remain, content_length)
end
@body.rewind if @body
end