Starts the CGI
process with the given environment env
and standard input and output stdin
and stdout
.
Sets the cookie expiration to the time t
. The expiration time may be a false value to disable expiration or a Time
or HTTP format time string to set the expiration date.
Retrieves the expiration time as a Time
The cookie string suitable for use in an HTTP header
The host this request is for
The port this request is for
Sets the response’s status to the status
code
The HTTP version as show in the HTTP request and response. For example, “1.1”
Shortcut for logging an ERROR
message
Will the logger output ERROR
messages?
Formats arg
for the logger
If arg
is an Exception
, it will format the error message and the back trace.
If arg
responds to to_str, it will return it.
Otherwise it will return arg
.inspect.
A SimpleServer
only yields when you start it
Performs the standard operations for daemonizing a process. Runs a block, if given.
Adds listeners from address
and port
to the server. See WEBrick::Utils::create_listeners
for details.
Starts the server and runs the block
for each connection. This method does not return until the server is stopped from a signal handler or another thread using stop
or shutdown
.
If the block raises a subclass of StandardError
the exception is logged and ignored. If an IOError
or Errno::EBADF exception is raised the exception is ignored. If an Exception
subclass is raised the exception is logged and re-raised which stops the server.
To completely shut down a server call shutdown
from ensure:
server = WEBrick::GenericServer.new # or WEBrick::HTTPServer.new begin server.start ensure server.shutdown end
Changes the password for the Basic Authentication header to new_password
Generates a XML-RPC methodResponse document
When is_ret
is false
then the params
array must contain only one element, which is a structure of a fault return-value.
When is_ret
is true
then a normal return-value of all the given params
is created.
Returns all date/time components in an array.
Returns +[year, month, day, hour, min, sec]+.
The faultCode
and faultString
of the exception in a Hash
.
Converts the contents of the database to an in-memory Hash
, then calls Hash#reject
with the specified code block, returning a new Hash
.
Replaces the contents of the database with the contents of the specified object. Takes any object which implements the each_pair
method, including Hash
and DBM
objects.
Converts the contents of the database to an array of [key, value] arrays, and returns it.
Returns the bits in stat as a Fixnum
. Poking around in these bits is platform dependent.
fork { exit 0xab } #=> 26566 Process.wait #=> 26566 sprintf('%04x', $?.to_i) #=> "ab00"
Show pid and exit status as a string.
system("false") p $?.to_s #=> "pid 12766 exit 1"