method
meta_vars
v1_9_3_392 -
Show latest stable
- Class:
WEBrick::HTTPRequest
meta_vars()public
This method provides the metavariables defined by the revision 3 of “The WWW Common Gateway Interface Version 1.1” http://Web.Golux.Com/coar/cgi/
# File lib/webrick/httprequest.rb, line 256
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["PATH_TRANSLATED"] = nil # no plan to be provided
meta["QUERY_STRING"] = @query_string ? @query_string.dup : ""
meta["REMOTE_ADDR"] = @peeraddr[3]
meta["REMOTE_HOST"] = @peeraddr[2]
#meta["REMOTE_IDENT"] = nil # no plan to be provided
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 Related methods
- Instance methods
- []
- body
- content_length
- content_type
- continue
- each
- fixup
- host
- keep_alive?
- meta_vars
- orig_meta_vars
- orig_parse
- orig_parse_uri
- parse
- port
- query
- remote_ip
- server_name
- ssl?
- to_s
- Class methods
- new
- Private methods
-
_read_data -
parse_query -
parse_uri -
read_body -
read_chunk_size -
read_chunked -
read_data -
read_header -
read_line -
read_request_line -
setup_forwarded_info