Create a hash of HTTP response headers
#!/usr/bin/ruby
require "cgi"
cgi = CGI.new("html3")
header = { 'status' => 'OK',
'cookie' => [cookie],
'Refresh' => 2,
'Recipe Name' => 'Setting HTTP Response Headers',
'server' => ENV['SERVER_SOFTWARE'] }
cgi.out(header) do
cgi.html('PRETTY' => ' ') do
cgi.head { cgi.title { 'Setting HTTP Response Headers' } } +
cgi.body do
cgi.p('Your headers:') +
cgi.pre{ cgi.header(header) } +
cgi.pre do
"#: #{hits}\n"+
"Last connected: #{last}"
end
end
end
end
Related examples in the same category