Digest
authentication for proxy servers. See DigestAuth
for details.
Htdigest
accesses apache-compatible digest password files. Passwords are matched to a realm where they are valid. For security, the path for a digest password database should be stored outside of the paths available to the HTTP server.
Htdigest
is intended for use with WEBrick::HTTPAuth::DigestAuth
and stores passwords using cryptographic hashes.
htpasswd = WEBrick::HTTPAuth::Htdigest.new 'my_password_file' htpasswd.set_passwd 'my realm', 'username', 'password' htpasswd.flush
AbstractServlet
allows HTTP server modules to be reused across multiple servers and allows encapsulation of functionality.
By default a servlet will respond to GET, HEAD (through an alias to GET) and OPTIONS requests.
By default a new servlet is initialized for every request. A servlet instance can be reused by overriding ::get_instance
in the AbstractServlet
subclass.
class Simple < WEBrick::HTTPServlet::AbstractServlet def do_GET request, response status, content_type, body = do_stuff_with request response.status = status response['Content-Type'] = content_type response.body = body end def do_stuff_with request return 200, 'text/plain', 'you got a page' end end
This servlet can be mounted on a server at a given path:
server.mount '/simple', Simple
Servlets can be configured via initialize. The first argument is the HTTP server the servlet is being initialized for.
class Configurable < Simple def initialize server, color, size super server @color = color @size = size end def do_stuff_with request content = "<p " \ %q{style="color: #{@color}; font-size: #{@size}"} \ ">Hello, World!" return 200, "text/html", content end end
This servlet must be provided two arguments at mount time:
server.mount '/configurable', Configurable, 'red', '2em'
Root of the HTTP status class hierarchy
Root of the HTTP error statuses
Root of the HTTP client error statuses
Stores multipart form data. FormData
objects are created when WEBrick::HTTPUtils.parse_form_data
is called.
The TextConstruct
module is used to define a Text construct Atom
element, which is used to store small quantities of human-readable text.
The TextConstruct
has a type attribute, e.g. text, html, xhtml
Reference: validator.w3.org/feed/docs/rfc4287.html#text.constructs
The PersonConstruct
module is used to define a person Atom
element that can be used to describe a person, corporation or similar entity.
The PersonConstruct
has a Name
, Uri
and Email
child elements.
Reference: validator.w3.org/feed/docs/rfc4287.html#atomPersonConstruct
Element
used to describe an Atom
date and time in the ISO 8601 format
Examples:
2013-03-04T15:30:02Z
2013-03-04T10:30:02-05:00
Indicates some other unhandled resolver error was encountered.
PersonConstruct
that contains information regarding the contributors of a Feed
or Entry
.
Reference: validator.w3.org/feed/docs/rfc4287.html#element.contributor
Contains information on the agent used to generate the feed.
Reference: validator.w3.org/feed/docs/rfc4287.html#element.generator
IO
wrapper that allows writing a limited amount of data