method
header
v1_8_7_72 -
Show latest stable
- Class:
CGI
header(*options)public
make HTTP header string
# File lib/cgi-lib.rb, line 220
def CGI::header(*options)
if defined?(MOD_RUBY)
options.each{|option|
option.sub(/(.*?): (.*)/){
Apache::request.headers_out[$1] = $2
}
}
Apache::request.send_http_header
''
else
if options.delete("nph") or (ENV['SERVER_SOFTWARE'] =~ /IIS/)
[(ENV['SERVER_PROTOCOL'] or "HTTP/1.0") + " 200 OK",
"Date: " + rfc1123_date(Time.now),
"Server: " + (ENV['SERVER_SOFTWARE'] or ""),
"Connection: close"] +
(options.empty? ? ["Content-Type: text/html"] : options)
else
options.empty? ? ["Content-Type: text/html"] : options
end.join(EOL) + EOL + EOL
end
end Related methods
- Instance methods
- header
- out
- read_from_cmdline
- Class methods
- cookie
- error
- escape
- escape
- escapeElement
- escapeHTML
- escapeHTML
- header
- message
- new
- new
- parse
- pretty
- rfc1123_date
- rfc1123_date
- tag
- unescape
- unescape
- unescapeElement
- unescapeHTML
- Private methods
-
env_table -
stdinput -
stdoutput