def initialize(params, socket, dispatcher)
@params = params
@socket = socket
content_length = params[Const::CONTENT_LENGTH].to_i
remain = content_length - params.http_body.length
dispatcher.request_begins(params) if dispatcher
if remain <= 0
@body = StringIO.new
@body.write params.http_body
dispatcher.request_progress(params, 0, content_length) if dispatcher
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, dispatcher)
end
@body.rewind if body
end