# File lib/stomp_server/protocols/http.rb, line 38
    def parse_request data
      @buf << data
      case @state
      when :headers
        @nparsed = @parser.execute(@params, @buf, @nparsed)
        if @parser.finished?
          @request = Mongrel::HttpRequest.new(@params,@buf)
          @request_method = @request.params[Mongrel::Const::REQUEST_METHOD]
          content_length = @request.params[Mongrel::Const::CONTENT_LENGTH].to_i
          @request_length = @nparsed + content_length
          @remain = content_length - @request.params.http_body.length
          if @remain <= 0
            @buf = @buf[@request_length+1..-1] || ''
            process_request
            post_init
            return
          end
          @request.body.write @request.params.http_body
          @state = :body
        end
      when :body
        @remain -= @request.body.write data[0...@remain]
        if @remain <= 0
          @buf = @buf[@request_length+1..-1] || ''
          process_request
          post_init
          return
        end
      end
    end