The parent class for all constructed encodings. The value
attribute of a Constructive
is always an Array
. Attributes are the same as for ASN1Data
, with the addition of tagging
.
Most constructed encodings come in the form of a SET or a SEQUENCE. These encodings are represented by one of the two sub-classes of Constructive:
OpenSSL::ASN1::Sequence
Please note that tagged sequences and sets are still parsed as instances of ASN1Data
. Find
further details on tagged values there.
int = OpenSSL::ASN1::Integer.new(1) str = OpenSSL::ASN1::PrintableString.new('abc') sequence = OpenSSL::ASN1::Sequence.new( [ int, str ] )
int = OpenSSL::ASN1::Integer.new(1) str = OpenSSL::ASN1::PrintableString.new('abc') set = OpenSSL::ASN1::Set.new( [ int, str ] )
The only case where Constructive
is used directly is for infinite length encodings of primitive values. These encodings are always constructed, with the contents of the value
Array
being either UNIVERSAL non-infinite length partial encodings of the actual value or again constructive encodings with infinite length (i.e. infinite length primitive encodings may be constructed recursively with another infinite length value within an already infinite length value). Each partial encoding must be of the same UNIVERSAL type as the overall encoding. The value of the overall encoding consists of the concatenation of each partial encoding taken in sequence. The value
array of the outer infinite length value must end with a OpenSSL::ASN1::EndOfContent instance.
Please note that it is not possible to encode Constructive
without the infinite_length
attribute being set to true
, use OpenSSL::ASN1::Sequence or OpenSSL::ASN1::Set
in these cases instead.
partial1 = OpenSSL::ASN1::OctetString.new("\x01") partial2 = OpenSSL::ASN1::OctetString.new("\x02") inf_octets = OpenSSL::ASN1::Constructive.new( [ partial1, partial2, OpenSSL::ASN1::EndOfContent.new ], OpenSSL::ASN1::OCTET_STRING, nil, :UNIVERSAL ) # The real value of inf_octets is "\x01\x02", i.e. the concatenation # of partial1 and partial2 inf_octets.infinite_length = true der = inf_octets.to_der asn1 = OpenSSL::ASN1.decode(der) puts asn1.infinite_length # => true
This is the generic exception for OpenSSL::Engine
related errors
This class represents a YAML Mapping.
A Psych::Nodes::Mapping
node may have 0 or more children, but must have an even number of children. Here are the valid children a Psych::Nodes::Mapping
node may have:
Represents a YAML stream. This is the root node for any YAML parse tree. This node must have one or more child nodes. The only valid child node for a Psych::Nodes::Stream
node is Psych::Nodes::Document
.
Raised when a tar file is corrupt
An InstalledSpecification
represents a gem that is already installed locally.
A set of gems for installation sourced from remote sources and local .gem files
The TrustDir
manages the trusted certificates for gem signature verification.
Represents an installed gem. This is used for dependency resolution.
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'