meta_vars()
  public
  
    
    
This method provides the metavariables defined by the revision 3 of “The
WWW Common Gateway Interface Version 1.1” To browse the current document
of CGI Version 1.1, see below: http://tools.ietf.org/html/rfc3875
   
  
    Show source    
    
      
    def meta_vars
      meta = Hash.new
      cl = self["Content-Length"]
      ct = self["Content-Type"]
      meta["CONTENT_LENGTH"]    = cl if cl.to_i > 0
      meta["CONTENT_TYPE"]      = ct.dup if ct
      meta["GATEWAY_INTERFACE"] = "CGI/1.1"
      meta["PATH_INFO"]         = @path_info ? @path_info.dup : ""
     
      meta["QUERY_STRING"]      = @query_string ? @query_string.dup : ""
      meta["REMOTE_ADDR"]       = @peeraddr[3]
      meta["REMOTE_HOST"]       = @peeraddr[2]
     
      meta["REMOTE_USER"]       = @user
      meta["REQUEST_METHOD"]    = @request_method.dup
      meta["REQUEST_URI"]       = @request_uri.to_s
      meta["SCRIPT_NAME"]       = @script_name.dup
      meta["SERVER_NAME"]       = @host
      meta["SERVER_PORT"]       = @port.to_s
      meta["SERVER_PROTOCOL"]   = "HTTP/" + @config[:HTTPVersion].to_s
      meta["SERVER_SOFTWARE"]   = @config[:ServerSoftware].dup
      self.each{|key, val|
        next if /^content-type$/ =~ key
        next if /^content-length$/ =~ key
        name = "HTTP_" + key
        name.gsub!(/-/, "_")
        name.upcase!
        meta[name] = val
      }
      meta
    end