method
new
v1_8_6_287 -
Show latest stable
-
0 notes -
Class: CGI
- 1_8_6_287 (0)
- 1_8_7_72 (16)
- 1_8_7_330 (-16)
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (38)
- 1_9_3_392 (0)
- What's this?
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


