method
new
new(input = $stdin)
public
Hide source
# File lib/cgi-lib.rb, line 162 def initialize(input = $stdin) @inputs = {} @cookie = {} case ENV['REQUEST_METHOD'] when "GET" ENV['QUERY_STRING'] or "" when "POST" input.read(Integer(ENV['CONTENT_LENGTH'])) or "" else read_from_cmdline end.split(/[&;]/).each do |x| key, val = x.split(/=/,2).collect{|x|CGI::unescape(x)} if @inputs.include?(key) @inputs[key] += "\0" + (val or "") else @inputs[key] = (val or "") end end super(@inputs) if ENV.has_key?('HTTP_COOKIE') or ENV.has_key?('COOKIE') (ENV['HTTP_COOKIE'] or ENV['COOKIE']).split(/; /).each do |x| key, val = x.split(/=/,2) key = CGI::unescape(key) val = val.split(/&/).collect{|x|CGI::unescape(x)}.join("\0") if @cookie.include?(key) @cookie[key] += "\0" + val else @cookie[key] = val end end end end