not using offline mode in webrick

M

Max Benjamin

Hello list,
I'm using webrick to serve up rhtml pages and can't seem to access cgi
variables. My very very simple server looks like this:
########################
require 'webrick'
include WEBrick

def start_webrick(config = {})
config.update:)Port => 8080)
config.update:)MimeTypes => {'rhtml' => 'text/html'})
server = HTTPServer.new(config)
yield server if block_given?
['INT', 'TERM'].each {|signal|
trap(signal) {server.shutdown}
}
ruby_dir = File.expand_path('html')
server.mount("html", HTTPServlet::ERBHandler, ruby_dir)
server.start
end

start_webrick:)DocumentRoot => 'html')
#########################

When I attempt to get cgi variables I receive the following message:
(offline mode: enter name=value pairs on standard input)

How do I run the program in "non-offline" mode?

Thanks for the help!
 
E

Eric Hodel

Hello list,
I'm using webrick to serve up rhtml pages and can't seem to access cgi
variables. My very very simple server looks like this:
########################
require 'webrick'
include WEBrick

def start_webrick(config = {})
config.update:)Port => 8080)
config.update:)MimeTypes => {'rhtml' => 'text/html'})
server = HTTPServer.new(config)
yield server if block_given?
['INT', 'TERM'].each {|signal|
trap(signal) {server.shutdown}
}
ruby_dir = File.expand_path('html')
server.mount("html", HTTPServlet::ERBHandler, ruby_dir)
server.start
end

start_webrick:)DocumentRoot => 'html')
#########################

When I attempt to get cgi variables I receive the following message:
(offline mode: enter name=value pairs on standard input)

How do I run the program in "non-offline" mode?

Don't use CGI variables, use objects handed to the ERb page by
WEBrick. I think they're in meta_vars and query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top