def fill_rack_env(env = {})
      env["rack.input"] = @body || StringIO.new
      env["REQUEST_METHOD"] = @method
      env["SCRIPT_NAME"] = ""
      env["REQUEST_URI"] = @path
      env["PATH_INFO"], query = @path.split("?", 2)
      env["QUERY_STRING"] = query || ""
      if (@headers["HOST"] && !env["SERVER_NAME"])
        env["SERVER_NAME"], port = @headers["HOST"].split(":", 2)
        env["SERVER_PORT"] = port if port
      end
      @headers.each do |key, val|
        if (key == 'CONTENT_LENGTH' || key == 'CONTENT_TYPE')
          env[key] = val
        else
          env["HTTP_#{key}"] = val
        end
      end
      return env
    end
def fill_rack_env(env = {})
      env["rack.input"] = @body || StringIO.new
      env["REQUEST_METHOD"] = @method
      env["SCRIPT_NAME"] = ""
      env["REQUEST_URI"] = @path
      env["PATH_INFO"], query = @path.split("?", 2)
      env["QUERY_STRING"] = query || ""
      if (@headers["HOST"] && !env["SERVER_NAME"])
        env["SERVER_NAME"], port = @headers["HOST"].split(":", 2)
        env["SERVER_PORT"] = port if port
      end
      @headers.each do |key, val|
        if (key == 'CONTENT_LENGTH' || key == 'CONTENT_TYPE')
          env[key] = val
        else
          env["HTTP_#{key}"] = val
        end
      end
      return env
    end
Given a basic rack environment, will properly fill it in
 with the information gleaned from the parsed request. Note that
 this only fills the subset that can be determined by the parser
 library. Namely, the only rack. variable set is rack.input. You should also
 have defaults in place for SERVER_NAME and SERVER_PORT, as they
 are required.