# File lib/mongrel.rb, line 190
    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

      # Some clients (like FF1.0) report 0 for body and then send a body.  This will probably truncate them but at least the request goes through usually.
      if remain <= 0
        # we've got everything, pack it up
        @body = StringIO.new
        @body.write params.http_body
        dispatcher.request_progress(params, 0, content_length) if dispatcher
      elsif remain > 0
        # must read more data to complete body
        if remain > Const::MAX_BODY
          # huge body, put it in a tempfile
          @body = Tempfile.new(Const::MONGREL_TMP_BASE)
          @body.binmode
        else
          # small body, just use that
          @body = StringIO.new 
        end

        @body.write params.http_body
        read_body(remain, content_length, dispatcher)
      end

      @body.rewind if body
    end