# Not using offline mode in webrick

**URL:** <https://www.ruby-forum.com/t/not-using-offline-mode-in-webrick/90206>\
**Category:** Ruby\
**Created:** [March 26, 2007, 8:37pm UTC](https://www.ruby-forum.com/t/not-using-offline-mode-in-webrick/90206 "2007-03-26T20:37:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxbohr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@maxbohr](https://www.ruby-forum.com/u/maxbohr)\
**Post date:** [March 26, 2007, 8:37pm UTC](https://www.ruby-forum.com/t/not-using-offline-mode-in-webrick/90206/1 "2007-03-26T20:37:15Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![maxbohr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@maxbohr](https://www.ruby-forum.com/u/maxbohr)\
**Post date:** [March 28, 2007, 4:50am UTC](https://www.ruby-forum.com/t/not-using-offline-mode-in-webrick/90206/2 "2007-03-28T04:50:49Z")

</div>

On Mar 26, 2007, at 11:37, Max B. wrote:

> server = HTTPServer.new(config)  
> #########################
> 
> 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.

---

<div class="post-metadata">

**Author:** ![maxbohr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@maxbohr](https://www.ruby-forum.com/u/maxbohr)\
**Post date:** [March 28, 2007, 6:13am UTC](https://www.ruby-forum.com/t/not-using-offline-mode-in-webrick/90206/3 "2007-03-28T06:13:28Z")

</div>

Thanks
