Net::HTTP
exception class. You cannot use Net::HTTPExceptions
directly; instead, you must use its subclasses.
Acceptable argument classes. Now contains DecimalInteger, OctalInteger and DecimalNumeric. See Acceptable argument classes (in source code).
This module is responsible for converting the prism syntax tree into other syntax trees.
Utility methods for using the RubyGems API.
The WebauthnListener
class retrieves an OTP after a user successfully WebAuthns with the Gem
host. An instance opens a socket using the TCPServer
instance given and listens for a request from the Gem
host. The request should be a GET request to the root path and contains the OTP code in the form of a query parameter ‘code`. The listener will return the code which will be used as the OTP for API requests.
Types of responses sent by the listener after receiving a request:
- 200 OK: OTP code was successfully retrieved - 204 No Content: If the request was an OPTIONS request - 400 Bad Request: If the request did not contain a query parameter `code` - 404 Not Found: The request was not to the root path - 405 Method Not Allowed: OTP code was not retrieved because the request was not a GET/OPTIONS request
Example usage:
thread = Gem::WebauthnListener.listener_thread("https://rubygems.example", server) thread.join otp = thread[:otp] error = thread[:error]
The WebauthnListener
Response class is used by the WebauthnListener
to create responses to be sent to the Gem
host. It creates a Gem::Net::HTTPResponse instance when initialized and can be converted to the appropriate format to be sent by a socket using ‘to_s`. Gem::Net::HTTPResponse instances cannot be directly sent over a socket.
Types of response classes:
- OkResponse - NoContentResponse - BadRequestResponse - NotFoundResponse - MethodNotAllowedResponse
Example usage:
server = TCPServer.new(0) socket = server.accept response = OkResponse.for("https://rubygems.example") socket.print response.to_s socket.close
The WebauthnPoller
class retrieves an OTP after a user successfully WebAuthns. An instance polls the Gem
host for the OTP code. The polling request (api/v1/webauthn_verification/<webauthn_token>/status.json) is sent to the Gem
host every 5 seconds and will timeout after 5 minutes. If the status field in the json response is “success”, the code field will contain the OTP code.
Example usage:
thread = Gem::WebauthnPoller.poll_thread( {}, "RubyGems.org", "https://rubygems.org/api/v1/webauthn_verification/odow34b93t6aPCdY", { email: "email@example.com", password: "password" } ) thread.join otp = thread[:otp] error = thread[:error]
A stub yaml serializer that can handle only hashes and strings (as of now).
An SSLContext
is used to set various options regarding certificates, algorithms, verification, session caching, etc. The SSLContext
is used to create an SSLSocket
.
All attributes must be set before creating an SSLSocket
as the SSLContext
will be frozen afterward.
SSLServer
represents a TCP/IP server socket with Secure Sockets Layer.
An OpenSSL::OCSP::BasicResponse
contains the status of a certificate check which is created from an OpenSSL::OCSP::Request
. A BasicResponse
is more detailed than a Response
.
Generic error class raised by SSLSocket
and SSLContext
.
This class represents a YAML Alias. It points to an anchor
.
A Psych::Nodes::Alias
is a terminal node and may have no children.
This class represents a YAML sequence.
A YAML
sequence is basically a list, and looks like this:
%YAML 1.1 --- - I am - a Sequence
A YAML
sequence may have an anchor like this:
%YAML 1.1 --- &A [ "This sequence", "has an anchor" ]
A YAML
sequence may also have a tag like this:
%YAML 1.1 --- !!seq [ "This sequence", "has a tag" ]
This class represents a sequence in a YAML
document. A Psych::Nodes::Sequence
node may have 0 or more children. Valid children for this node are:
Raised when the CRC checksum recorded in gzip file footer is not equivalent to the CRC checksum of the actual uncompressed data.
Raised when you try to write to a read-only buffer, or resize an external buffer.
Raised if you try to access a buffer slice which no longer references a valid memory range of the underlying source.
Class for representing HTTP method TRACE:
require 'net/http' uri = URI('http://example.com') hostname = uri.hostname # => "example.com" req = Net::HTTP::Trace.new(uri) # => #<Net::HTTP::Trace TRACE> res = Net::HTTP.start(hostname) do |http| http.request(req) end
See Request Headers.
Properties:
Request body: no.
Response body: yes.
Safe: yes.
Idempotent: yes.
Cacheable: no.
Related:
Net::HTTP#trace
: sends TRACE
request, returns response object.