Parent class for redirection (3xx) HTTP
response classes.
A redirection response indicates the client must take additional action to complete the request.
References:
Response class for Proxy Authentication Required
responses (status code 407).
The client must first authenticate itself with the proxy.
References:
Response class for Misdirected Request
responses (status code 421).
The request was directed at a server that is not able to produce a response.
References:
Response class for Network Authentication Required
responses (status code 511).
The client needs to authenticate to gain network access.
References:
A StoreContext
is used while validating a single certificate and holds the status involved.
Psych::Stream
is a streaming YAML
emitter. It will not buffer your YAML
, but send it straight to an IO
.
Here is an example use:
stream = Psych::Stream.new($stdout) stream.start stream.push({:foo => 'bar'}) stream.finish
YAML
will be immediately emitted to $stdout with no buffering.
Psych::Stream#start
will take a block and ensure that Psych::Stream#finish
is called, so you can do this form:
stream = Psych::Stream.new($stdout) stream.start do |em| em.push(:foo => 'bar') end
Socket::ResolutionError
is the error class for hostname resolution.
Subclass of Zlib::Error
When zlib returns a Z_STREAM_END is return if the end of the compressed data has been reached and all uncompressed out put has been produced.
Subclass of Zlib::Error
When zlib returns a Z_STREAM_ERROR, usually if the stream state was inconsistent.
Subclass of Zlib::Error
When zlib returns a Z_VERSION_ERROR, usually if the zlib library version is incompatible with the version assumed by the caller.
Zlib::ZStream
is the abstract class for the stream which handles the compressed data. The operations are defined in the subclasses: Zlib::Deflate
for compression, and Zlib::Inflate
for decompression.
An instance of Zlib::ZStream
has one stream (struct zstream in the source) and two variable-length buffers which associated to the input (next_in) of the stream and the output (next_out) of the stream. In this document, “input buffer” means the buffer for input, and “output buffer” means the buffer for output.
Data
input into an instance of Zlib::ZStream
are temporally stored into the end of input buffer, and then data in input buffer are processed from the beginning of the buffer until no more output from the stream is produced (i.e. until avail_out
> 0 after processing). During processing, output buffer is allocated and expanded automatically to hold all output data.
Some particular instance methods consume the data in output buffer and return them as a String
.
Here is an ascii art for describing above:
+================ an instance of Zlib::ZStream ================+ || || || +--------+ +-------+ +--------+ || || +--| output |<---------|zstream|<---------| input |<--+ || || | | buffer | next_out+-------+next_in | buffer | | || || | +--------+ +--------+ | || || | | || +===|======================================================|===+ | | v | "output data" "input data"
If an error occurs during processing input buffer, an exception which is a subclass of Zlib::Error
is raised. At that time, both input and output buffer keep their conditions at the time when the error occurs.
Method
Catalogue Many of the methods in this class are fairly low-level and unlikely to be of interest to users. In fact, users are unlikely to use this class directly; rather they will be interested in Zlib::Inflate
and Zlib::Deflate
.
The higher level methods are listed below.
HTTPGenericRequest is the parent of the Net::HTTPRequest
class.
Do not use this directly; instead, use a subclass of Net::HTTPRequest
.
This class is the base class for Net::HTTP request classes. The class should not be used directly; instead you should use its subclasses, listed below.
An request object may be created with either a URI
or a string hostname:
require 'net/http' uri = URI('https://jsonplaceholder.typicode.com/') req = Net::HTTP::Get.new(uri) # => #<Net::HTTP::Get GET> req = Net::HTTP::Get.new(uri.hostname) # => #<Net::HTTP::Get GET>
And with any of the subclasses:
req = Net::HTTP::Head.new(uri) # => #<Net::HTTP::Head HEAD> req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST> req = Net::HTTP::Put.new(uri) # => #<Net::HTTP::Put PUT> # ...
The new instance is suitable for use as the argument to Net::HTTP#request
.
A new request object has these header fields by default:
req.to_hash # => {"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"], "accept"=>["*/*"], "user-agent"=>["Ruby"], "host"=>["jsonplaceholder.typicode.com"]}
See:
You can add headers or override default headers:
# res = Net::HTTP::Get.new(uri, {'foo' => '0', 'bar' => '1'})
This class (and therefore its subclasses) also includes (indirectly) module Net::HTTPHeader
, which gives access to its methods for setting headers.
Subclasses for HTTP requests:
Subclasses for WebDAV requests:
Response class for Bad Request
responses (status code 400).
The server cannot or will not process the request due to an apparent client error.
References:
Response class for Request Timeout
responses (status code 408).
The server timed out waiting for the request.
References:
Response class for Request Timeout
responses (status code 408).
The server timed out waiting for the request.
References:
Response class for Payload Too Large
responses (status code 413).
The request is larger than the server is willing or able to process.
References:
Response class for URI Too Long
responses (status code 414).
The URI
provided was too long for the server to process.
References:
Response class for Range Not Satisfiable
responses (status code 416).
The request entity has a media type which the server or resource does not support.
References:
Response class for Too Many Requests
responses (status code 429).
The user has sent too many requests in a given amount of time.
References:
Response class for HTTP Version Not Supported
responses (status code 505).
The server does not support the HTTP
version used in the request.
References:
EmbDocComment
objects correspond to comments that are surrounded by =begin and =end.
Raised when trying to activate a gem, and the gem exists on the system, but not the requested version. Instead of rescuing from this class, make sure to rescue from the superclass Gem::LoadError
to catch all types of load errors.