An OpenSSL::OCSP::Request
contains the certificate information for determining if a certificate has been revoked or not. A Request
can be created for a certificate or from a DER-encoded request created elsewhere.
Generic exception class of the Timestamp
module.
Immutable and read-only representation of a timestamp token info from a Response
.
Allows to create timestamp requests or parse existing ones. A Request
is also needed for creating timestamps from scratch with Factory
. When created from scratch, some default values are set:
version is set to 1
cert_requested is set to true
algorithm, message_imprint
, policy_id
, and nonce are set to false
The X509
certificate store holds trusted CA certificates used to verify peer certificates.
The easiest way to create a useful certificate store is:
cert_store = OpenSSL::X509::Store.new cert_store.set_default_paths
This will use your system’s built-in certificates.
If your system does not have a default set of certificates you can obtain a set extracted from Mozilla CA certificate store by cURL maintainers here: curl.haxx.se/docs/caextract.html (You may wish to use the firefox-db2pem.sh script to extract the certificates from a local install to avoid man-in-the-middle attacks.)
After downloading or generating a cacert.pem from the above link you can create a certificate store from the pem file like this:
cert_store = OpenSSL::X509::Store.new cert_store.add_file 'cacert.pem'
The certificate store can be used with an SSLSocket like this:
ssl_context = OpenSSL::SSL::SSLContext.new ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER ssl_context.cert_store = cert_store tcp_socket = TCPSocket.open 'example.com', 443 ssl_socket = OpenSSL::SSL::SSLSocket.new tcp_socket, ssl_context
Psych::JSON::TreeBuilder
is an event based AST builder. Events are sent to an instance of Psych::JSON::TreeBuilder
and a JSON
AST is constructed.
YAMLTree
builds a YAML
ast given a Ruby
object. For example:
builder = Psych::Visitors::YAMLTree.new builder << { :foo => 'bar' } builder.tree # => #<Psych::Nodes::Stream .. }
Predefined Keys
Raised when the data length recorded in the gzip file footer is not equivalent to the length of the actual uncompressed data.
Raised if you try to access a buffer slice which no longer references a valid memory range of the underlying source.
File-based session storage class.
Implements session storage as a flat file of ‘key=value’ values. This storage type only works directly with String
values; the user is responsible for converting other types to Strings when storing and from Strings when retrieving.
In-memory session storage class.
Implements session storage as a global in-memory hash. Session
data will only persist for as long as the Ruby
interpreter instance does.
Dummy session storage class.
Implements session storage place holder. No actual storage will be done.
PStore-based session storage class.
This builds upon the top-level PStore
class provided by the library file pstore.rb. Session
data is marshalled and stored in a file. File
locking and transaction services are provided.
Class for representing HTTP method POST:
require 'net/http' uri = URI('http://example.com') hostname = uri.hostname # => "example.com" uri.path = '/posts' req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST> req.body = '{"title": "foo","body": "bar","userId": 1}' req.content_type = 'application/json' res = Net::HTTP.start(hostname) do |http| http.request(req) end
See Request Headers.
Properties:
Request body: yes.
Response body: yes.
Safe: no.
Idempotent: no.
Cacheable: yes.
Related:
Net::HTTP.post
: sends POST
request, returns response object.
Net::HTTP#post
: sends POST
request, returns response object.